Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
root: true,
extends: ['react-app', 'react-app/jest'],
extends: ['react-app'],
ignorePatterns: ['build/', 'dist/', 'docs/', 'node_modules/'],
plugins: ['lodash'],
rules: {
Expand Down
2 changes: 2 additions & 0 deletions e2e/helpers/modeltestOutcome.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

const { parseModelTestLog } = require('./modeltestOutcome');
const { compareOutcome, formatReport } = require('./fixtures');

Expand Down
2 changes: 2 additions & 0 deletions e2e/helpers/newick.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

const {
parseNewick,
getTaxa,
Expand Down
2 changes: 2 additions & 0 deletions e2e/helpers/raxmlHpcOutcome.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

const { parseRaxmlHpcOutput } = require('./raxmlHpcOutcome');

const info = `
Expand Down
2 changes: 2 additions & 0 deletions e2e/helpers/raxmlNgOutcome.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { describe, expect, it } from 'vitest';

const { parseRaxmlNgOutput } = require('./raxmlNgOutcome');

const log = `RAxML-NG v. 1.2.2 released on 30.04.2024 by The Exelixis Lab.
Expand Down
17 changes: 0 additions & 17 deletions jest.config.js

This file was deleted.

16 changes: 0 additions & 16 deletions jest/babelTransform.js

This file was deleted.

1 change: 0 additions & 1 deletion jest/fileMock.js

This file was deleted.

22 changes: 8 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"main": "./out/main/index.js",
"scripts": {
"start": "electron-vite dev",
"test": "jest --watchAll=false",
"react-test": "jest --watchAll=false",
"test": "vitest run",
"react-test": "vitest run",
"test:e2e": "yarn build && node node_modules/playwright/cli.js test --config e2e/playwright.config.js",
"test:e2e:update-fixtures": "yarn build && node e2e/updateFixtures.js",
"test:docs": "node node_modules/playwright/cli.js test --config e2e/docs/playwright.config.js",
Expand All @@ -51,8 +51,8 @@
"docs-serve": "cd docs && bundle exec jekyll serve --config _config.yml,_config_dev.yml",
"typecheck": "tsc --noEmit",
"typecheck:baseline": "node scripts/typecheck-baseline.js",
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\" electron.vite.config.js jest.config.js \"jest/**/*.js\" --max-warnings 0",
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" electron.vite.config.js jest.config.js \"jest/**/*.js\" --fix"
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\" electron.vite.config.js vitest.config.mjs --max-warnings 0",
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx}\" electron.vite.config.js vitest.config.mjs --fix"
},
"dependencies": {
"@emotion/react": "^11.14.0",
Expand Down Expand Up @@ -85,11 +85,6 @@
"yup": "^1.7.1"
},
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-react-jsx": "7.25.2",
"@babel/preset-env": "^7.29.7",
"@babel/preset-typescript": "^7.24.7",
"@electron/notarize": "^3.1.2",
"@sentry/bundler-plugins": "11.12.0",
"@sentry/cli": "^3.8.2",
Expand All @@ -102,7 +97,6 @@
"@typescript-eslint/eslint-plugin": "^8",
"@typescript-eslint/parser": "^8",
"@vitejs/plugin-react": "5.2.0",
"babel-jest": "27.5.1",
"dotenv": "^17.4.2",
"download": "^8.0.0",
"electron": "^45.2.3",
Expand All @@ -112,12 +106,13 @@
"eslint": "^8.57.0",
"eslint-config-react-app": "7.0.1",
"eslint-plugin-lodash": "^8.1.0",
"jest": "27.5.1",
"jsdom": "^29.1.1",
"npm-run-all": "^4.1.5",
"playwright": "^1.65.0",
"prettier": "^3.9.10",
"typescript": "^5.9.3",
"vite": "^8.3.7"
"vite": "^8.3.7",
"vitest": "^5.1.1"
},
"browserslist": [
">0.2%",
Expand All @@ -139,9 +134,9 @@
"!e2e{,/**/*}",
"!docs{,/**/*}",
"!electron.vite.config.js",
"!vitest.config.mjs",
"!static{,/**/*}",
"!scripts{,/**/*}",
"!jest{,/**/*}",
"!test-results{,/**/*}",
"!playwright-report{,/**/*}"
],
Expand Down Expand Up @@ -216,7 +211,6 @@
}
},
"resolutions": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@typescript-eslint/eslint-plugin": "^8.72.1",
"@typescript-eslint/parser": "^8.72.1"
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/App.test.js → src/app/App.test.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it } from 'vitest';
import React, { act } from 'react';
import { createRoot } from 'react-dom/client';
import Page from './index';
Expand All @@ -7,7 +8,6 @@ it( 'renders without crashing', () => {
const div = document.createElement( 'div' );
const root = createRoot( div );
// createRoot().render paints on a later tick. act flushes that paint.
// eslint-disable-next-line testing-library/no-unnecessary-act
act( () => {
root.render( <Page /> );
} );
Expand Down
22 changes: 11 additions & 11 deletions src/app/bootstrap.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it, vi } from 'vitest';

function loadBootstrap( nodeEnv ) {
async function loadBootstrap( nodeEnv ) {
const previousEnv = process.env.NODE_ENV;
const previousE2E = process.env.RAXMLGUI_E2E;
process.env.NODE_ENV = nodeEnv;
delete process.env.RAXMLGUI_E2E;
let store;
try {
jest.isolateModules( () => {
store = require( './store' ).default;
require( './bootstrap' );
} );
vi.resetModules();
store = ( await import( './store' ) ).default;
await import( './bootstrap' );
} finally {
process.env.NODE_ENV = previousEnv;
if ( previousE2E === undefined ) {
Expand All @@ -23,7 +23,7 @@ function loadBootstrap( nodeEnv ) {
}

it( 'the dev bootstrap loads the example files', async () => {
const getExampleFiles = jest.fn( async () => ( {
const getExampleFiles = vi.fn( async () => ( {
fasta: ['nucleotide.txt'],
phylip: ['dna_sequential.txt'],
dir: '/examples',
Expand All @@ -34,7 +34,7 @@ it( 'the dev bootstrap loads the example files', async () => {
parseAlignment: () => new Promise( () => {} ),
};

const store = loadBootstrap( 'development' );
const store = await loadBootstrap( 'development' );

expect( getExampleFiles ).toHaveBeenCalledTimes( 1 );
await getExampleFiles.mock.results[0].value;
Expand All @@ -44,11 +44,11 @@ it( 'the dev bootstrap loads the example files', async () => {
] );
} );

it( 'a production load does not ask for the example files', () => {
const getExampleFiles = jest.fn();
it( 'a production load does not ask for the example files', async () => {
const getExampleFiles = vi.fn();
window.rendererBridge = { getExampleFiles };

loadBootstrap( 'production' );
await loadBootstrap( 'production' );

expect( getExampleFiles ).not.toHaveBeenCalled();
} );
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it, vi } from 'vitest';
import React, { act } from 'react';
import { createRoot } from 'react-dom/client';
import ErrorDialog from './ErrorDialog';

it( 'the reload action reloads the window', () => {
const reload = jest.fn();
const reload = vi.fn();
window.rendererBridge = { reload };
const div = document.createElement( 'div' );
document.body.appendChild( div );
const root = createRoot( div );
// createRoot().render paints on a later tick. act flushes that paint.
// eslint-disable-next-line testing-library/no-unnecessary-act
act( () => {
root.render(
<ErrorDialog
Expand Down Expand Up @@ -40,7 +40,6 @@ function renderDialog( error ) {
document.body.appendChild( div );
const root = createRoot( div );
// createRoot().render paints on a later tick. act flushes that paint.
// eslint-disable-next-line testing-library/no-unnecessary-act
act( () => {
root.render(
<ErrorDialog
Expand Down Expand Up @@ -71,11 +70,11 @@ Locale: en-US`;
return { command: 'raxml -s primates.fasta', stdout: '' };
},
};
const debugInfo = jest.fn( async () => {
const debugInfo = vi.fn( async () => {
order.push( 'debug' );
return info;
} );
const openExternal = jest.fn( async () => {
const openExternal = vi.fn( async () => {
order.push( 'open' );
} );
window.rendererBridge = { debugInfo, openExternal };
Expand Down
12 changes: 6 additions & 6 deletions src/app/droppedFile.test.js → src/app/droppedFile.test.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it, vi } from 'vitest';
import React, { act } from 'react';
import { createRoot } from 'react-dom/client';
import { ThemeProvider } from '@mui/material/styles';
Expand All @@ -21,10 +22,10 @@ function baseRun( extra ) {
tree: closedTree,
backboneConstraint: closedTree,
multifurcatingConstraint: closedTree,
addAlignments: jest.fn(),
addPartitionFiles: jest.fn(),
addTreeFiles: jest.fn(),
addAstralFiles: jest.fn(),
addAlignments: vi.fn(),
addPartitionFiles: vi.fn(),
addTreeFiles: vi.fn(),
addAstralFiles: vi.fn(),
loadAlignmentFiles() {},
loadAstralTree() {},
loadPartitionFile() {},
Expand All @@ -39,7 +40,6 @@ function mountInput( run ) {
const div = document.createElement( 'div' );
const root = createRoot( div );
// createRoot().render paints on a later tick. act flushes that paint.
// eslint-disable-next-line testing-library/no-unnecessary-act
act( () => {
root.render(
<ThemeProvider theme={theme.light}>
Expand Down
3 changes: 2 additions & 1 deletion src/app/paths.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it } from 'vitest';
import {
base, basename, dir, join, name, quote,
} from './paths';
Expand Down
3 changes: 2 additions & 1 deletion src/app/promisedComputed.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it } from 'vitest';
import { observable, runInAction, reaction, when } from 'mobx';
import { promisedComputed } from './promisedComputed';

Expand Down
3 changes: 2 additions & 1 deletion src/app/report.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it } from 'vitest';
import { cleanStack, serializeAndCleanError } from './report';

it( 'drops node and electron frames from a stack', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/app/store/AlignmentOptions.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { beforeEach, describe, expect, it } from 'vitest';
import { autorun, runInAction } from 'mobx';

import Run from './Run';
Expand Down
21 changes: 11 additions & 10 deletions src/app/store/InputFile.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { autorun, runInAction } from 'mobx';

import AstralTree from './AstralTree';
Expand All @@ -9,9 +10,9 @@ let bridge;

beforeEach( () => {
bridge = {
getVersion: jest.fn( () => Promise.resolve( '2.0.0' ) ),
openPath: jest.fn( () => Promise.resolve() ),
showItemInFolder: jest.fn( () => Promise.resolve() ),
getVersion: vi.fn( () => Promise.resolve( '2.0.0' ) ),
openPath: vi.fn( () => Promise.resolve() ),
showItemInFolder: vi.fn( () => Promise.resolve() ),
};
window.rendererBridge = bridge;
} );
Expand All @@ -23,7 +24,7 @@ function track( fn ) {
return { seen, stop };
}

const run = { id: 'run1', removeAstralTree: jest.fn() };
const run = { id: 'run1', removeAstralTree: vi.fn() };

describe( 'StoreBase', () => {
it( 'initialises the version from the renderer bridge', async () => {
Expand All @@ -35,10 +36,10 @@ describe( 'StoreBase', () => {
} );

it( 'subscribe registers a bridge listener and unlisten stops them all', () => {
const stopA = jest.fn();
const stopB = jest.fn();
bridge.onRunStdout = jest.fn( () => stopA );
bridge.onRunStderr = jest.fn( () => stopB );
const stopA = vi.fn();
const stopB = vi.fn();
bridge.onRunStdout = vi.fn( () => stopA );
bridge.onRunStderr = vi.fn( () => stopB );
const store = new StoreBase();
const listener = () => {};
store.subscribe( 'onRunStdout', listener );
Expand All @@ -52,7 +53,7 @@ describe( 'StoreBase', () => {
} );

it( 'dispose stops the listeners', () => {
const stop = jest.fn();
const stop = vi.fn();
bridge.onRunStdout = () => stop;
const store = new StoreBase();
store.subscribe( 'onRunStdout', () => {} );
Expand Down
3 changes: 2 additions & 1 deletion src/app/store/Option.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { expect, it } from 'vitest';
import { autorun, runInAction } from 'mobx';
import * as yup from 'yup';

Expand Down
5 changes: 3 additions & 2 deletions src/app/store/OutGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { autorun, runInAction } from 'mobx';

import RunList from './RunList';
import { runEvents } from './StoreBase';

// A run subscribes to bridge events when it is created.
beforeEach( () => {
const bridge = { cancelRun: jest.fn(), getVersion: () => Promise.resolve( '2.0.0' ) };
const bridge = { cancelRun: vi.fn(), getVersion: () => Promise.resolve( '2.0.0' ) };
for ( const name of Object.values( runEvents ) ) {
bridge[name] = () => () => {};
}
Expand Down
3 changes: 2 additions & 1 deletion src/app/store/Part.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @ts-nocheck — Jest globals. checkJs has no test runner types.
// @ts-nocheck — the test is not typed yet.
import { beforeEach, describe, expect, it } from 'vitest';
import { autorun, runInAction } from 'mobx';

import Alignment from './Alignment';
Expand Down
Loading
Loading