diff --git a/README.md b/README.md index 141b210b..a06644c6 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ import React, { KeyboardEvent, } from 'react'; import { logger } from '@core/logger'; -import { reduce, debounce } from 'lodash'; +import { reduce, debounce } from 'lodash-es'; import { Message } from '../Message'; import { createServer } from '@server/node'; import { Alert } from '@ui/Alert'; @@ -29,7 +29,7 @@ import { createConnection } from '@server/database'; ### Output ```javascript -import { debounce, reduce } from 'lodash'; +import { debounce, reduce } from 'lodash-es'; import React, { ChangeEvent, FC, diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 3aadcd8a..9b9b3ffa 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -87,7 +87,7 @@ Due to the package handling of the pnpm, sometimes, the plugin is not automatica via prettier config. ```js module.exports = { - plugins: [require('@trivago/prettier-plugin-sort-imports')], + plugins: ['@trivago/prettier-plugin-sort-imports'], } ``` diff --git a/examples/example.ts b/examples/example.ts index f9a69c4c..9bcb69c4 100644 --- a/examples/example.ts +++ b/examples/example.ts @@ -6,7 +6,7 @@ import React, { KeyboardEvent, } from 'react'; import { logger } from '@core/logger'; -import { reduce, debounce } from 'lodash'; +import { reduce, debounce } from 'lodash-es'; import { Message } from '../Message'; import { createServer } from '@server/node'; import { Alert } from '@ui/Alert'; diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index a5465075..00000000 --- a/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -const ENABLE_COVERAGE = false; // !!process.env.CI; - -export default { - displayName: 'test', - setupFiles: ['/test-setup/run_spec.cjs'], - snapshotSerializers: ['/test-setup/raw-serializer.cjs'], - testRegex: 'ppsi\\.spec\\.cjs$|__tests__/.*\\.ts$', - collectCoverage: ENABLE_COVERAGE, - collectCoverageFrom: ['src/**/*.ts', '!/node_modules/'], - preset: 'ts-jest', - testEnvironment: 'node', -}; \ No newline at end of file diff --git a/package.json b/package.json index b16bb9d4..79029cfa 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "compile": "tsc", "preexample": "yarn run compile", "example": "prettier --config ./examples/.prettierrc --plugin lib/src/index.js", - "test": "yarn node --experimental-vm-modules $(yarn bin jest)", + "test": "vitest run", "type-check": "tsc --noEmit", "prepublishOnly": "npm run compile && npm run test" }, @@ -39,21 +39,21 @@ "@babel/traverse": "^7.26.7", "@babel/types": "^7.26.7", "javascript-natural-sort": "^0.7.1", - "lodash": "^4.17.21" + "lodash-es": "^4.17.21" }, "devDependencies": { "@babel/core": "^7.26.7", - "@types/chai": "^5.0.1", - "@types/jest": "^29.5.14", - "@types/lodash": "^4.17.14", + "@types/babel__core": "^7.20.5", + "@types/babel__generator": "^7.27.0", + "@types/babel__traverse": "^7.20.7", + "@types/lodash-es": "^4.17.12", "@types/node": "^22.10.10", "@vue/compiler-sfc": "^3.5.13", - "jest": "^29.7.0", "prettier": "^3.4.2", "prettier-plugin-svelte": "^3.3.3", "svelte": "^4.2.19", - "ts-jest": "^29.2.5", - "typescript": "^5.7.3" + "typescript": "^5.7.3", + "vitest": "^3.2.4" }, "peerDependencies": { "@vue/compiler-sfc": "3.x", diff --git a/src/index.ts b/src/index.ts index 562a5626..f4fa1467 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,7 @@ import { vuePreprocessor } from './preprocessors/vue-preprocessor'; import type { Options } from 'prettier'; import { createSvelteParsers } from './utils/create-svelte-parsers'; -const svelteParsers = createSvelteParsers(); +const svelteParsers = await createSvelteParsers(); const options: Options = { importOrder: { diff --git a/src/utils/__tests__/adjust-comments-on-sorted-nodes.spec.ts b/src/utils/__tests__/adjust-comments-on-sorted-nodes.spec.ts index acf76c09..eed70486 100644 --- a/src/utils/__tests__/adjust-comments-on-sorted-nodes.spec.ts +++ b/src/utils/__tests__/adjust-comments-on-sorted-nodes.spec.ts @@ -1,4 +1,5 @@ import { ImportDeclaration } from '@babel/types'; +import { expect, test } from 'vitest' import { adjustCommentsOnSortedNodes } from '../adjust-comments-on-sorted-nodes'; import { getImportNodes } from '../get-import-nodes'; diff --git a/src/utils/__tests__/get-all-comments-from-nodes.spec.ts b/src/utils/__tests__/get-all-comments-from-nodes.spec.ts index c076e927..07cc44ae 100644 --- a/src/utils/__tests__/get-all-comments-from-nodes.spec.ts +++ b/src/utils/__tests__/get-all-comments-from-nodes.spec.ts @@ -1,5 +1,6 @@ import { ParserOptions } from '@babel/parser'; import { CommentBlock, CommentLine, ImportDeclaration } from '@babel/types'; +import { expect, test } from 'vitest' import { getAllCommentsFromNodes } from '../get-all-comments-from-nodes'; import { getImportNodes } from '../get-import-nodes'; diff --git a/src/utils/__tests__/get-code-from-ast.spec.ts b/src/utils/__tests__/get-code-from-ast.spec.ts index 298e9640..18ae49f6 100644 --- a/src/utils/__tests__/get-code-from-ast.spec.ts +++ b/src/utils/__tests__/get-code-from-ast.spec.ts @@ -1,6 +1,7 @@ import { parse as babelParser } from '@babel/core'; import { ParserOptions } from '@babel/parser'; import { format } from 'prettier'; +import { expect, test } from 'vitest' import { extractASTNodes } from '../extract-ast-nodes'; import { getCodeFromAst } from '../get-code-from-ast'; @@ -54,7 +55,7 @@ import a from 'a';`; }; const ast = babelParser(code, parserOptions); if (!ast) throw new Error('ast is null'); - const { directives, importNodes } = extractASTNodes(ast); + const { directives, importNodes } = extractASTNodes(ast as any); const formatted = getCodeFromAst(importNodes, directives, code, null); expect(await format(formatted, { parser: 'babel' })).toEqual( diff --git a/src/utils/__tests__/get-experimental-parser-plugins.spec.ts b/src/utils/__tests__/get-experimental-parser-plugins.spec.ts index d1c7d35e..7688a0eb 100644 --- a/src/utils/__tests__/get-experimental-parser-plugins.spec.ts +++ b/src/utils/__tests__/get-experimental-parser-plugins.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest' + import { getExperimentalParserPlugins } from '../get-experimental-parser-plugins'; test('it should return empty list', () => { diff --git a/src/utils/__tests__/get-import-nodes-matched-group.spec.ts b/src/utils/__tests__/get-import-nodes-matched-group.spec.ts index b585eb48..023805bc 100644 --- a/src/utils/__tests__/get-import-nodes-matched-group.spec.ts +++ b/src/utils/__tests__/get-import-nodes-matched-group.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest' + import { THIRD_PARTY_MODULES_SPECIAL_WORD } from '../../constants'; import { ImportGroups } from '../../types'; import { getImportNodes } from '../get-import-nodes'; diff --git a/src/utils/__tests__/get-sorted-import-specifiers.spec.ts b/src/utils/__tests__/get-sorted-import-specifiers.spec.ts index 40675f27..0368651e 100644 --- a/src/utils/__tests__/get-sorted-import-specifiers.spec.ts +++ b/src/utils/__tests__/get-sorted-import-specifiers.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest' + import { getImportNodes } from '../get-import-nodes'; import { getSortedImportSpecifiers } from '../get-sorted-import-specifiers'; import { getSortedNodesModulesNames } from '../get-sorted-nodes-modules-names'; diff --git a/src/utils/__tests__/get-sorted-nodes-by-import-order.spec.ts b/src/utils/__tests__/get-sorted-nodes-by-import-order.spec.ts index a9cc8f6e..caa7019b 100644 --- a/src/utils/__tests__/get-sorted-nodes-by-import-order.spec.ts +++ b/src/utils/__tests__/get-sorted-nodes-by-import-order.spec.ts @@ -1,4 +1,5 @@ import { ImportDeclaration } from '@babel/types'; +import { expect, test } from 'vitest' import { getImportNodes } from '../get-import-nodes'; import { getSortedNodes } from '../get-sorted-nodes'; diff --git a/src/utils/__tests__/get-sorted-nodes.spec.ts b/src/utils/__tests__/get-sorted-nodes.spec.ts index 17dca351..25176cd9 100644 --- a/src/utils/__tests__/get-sorted-nodes.spec.ts +++ b/src/utils/__tests__/get-sorted-nodes.spec.ts @@ -1,4 +1,5 @@ import { ImportDeclaration } from '@babel/types'; +import { expect, test } from 'vitest' import { getImportNodes } from '../get-import-nodes'; import { getSortedNodes } from '../get-sorted-nodes'; diff --git a/src/utils/__tests__/is-sort-imports-ignored.spec.ts b/src/utils/__tests__/is-sort-imports-ignored.spec.ts index d1429d9b..37deb9f8 100644 --- a/src/utils/__tests__/is-sort-imports-ignored.spec.ts +++ b/src/utils/__tests__/is-sort-imports-ignored.spec.ts @@ -1,3 +1,5 @@ +import { expect, test } from 'vitest'; + import { getImportNodes } from '../get-import-nodes'; import { isSortImportsIgnored } from '../is-sort-imports-ignored'; diff --git a/src/utils/__tests__/remove-nodes-from-original-code.spec.ts b/src/utils/__tests__/remove-nodes-from-original-code.spec.ts index 21dd7858..1b0e44d2 100644 --- a/src/utils/__tests__/remove-nodes-from-original-code.spec.ts +++ b/src/utils/__tests__/remove-nodes-from-original-code.spec.ts @@ -1,4 +1,5 @@ import { format } from 'prettier'; +import { expect, test } from 'vitest' import { getAllCommentsFromNodes } from '../get-all-comments-from-nodes'; import { getImportNodes } from '../get-import-nodes'; diff --git a/src/utils/adjust-comments-on-sorted-nodes.ts b/src/utils/adjust-comments-on-sorted-nodes.ts index 91396e9e..e4e13a67 100644 --- a/src/utils/adjust-comments-on-sorted-nodes.ts +++ b/src/utils/adjust-comments-on-sorted-nodes.ts @@ -1,5 +1,5 @@ import { ImportDeclaration, addComments, removeComments } from '@babel/types'; -import { clone, isEqual } from 'lodash'; +import { clone, isEqual } from 'lodash-es'; import { ImportOrLine } from '../types'; diff --git a/src/utils/create-svelte-parsers.ts b/src/utils/create-svelte-parsers.ts index 1c72863d..25086ecc 100644 --- a/src/utils/create-svelte-parsers.ts +++ b/src/utils/create-svelte-parsers.ts @@ -1,8 +1,9 @@ -export function createSvelteParsers() { +export async function createSvelteParsers() { try { - var { parsers } = require('prettier-plugin-svelte'); + const sveltePlugin = await import('prettier-plugin-svelte'); + const { parsers } = (sveltePlugin.default || sveltePlugin) as any; + return { parsers }; } catch { return {}; } - return { parsers }; -} \ No newline at end of file +} diff --git a/src/utils/get-sorted-nodes-by-import-order.ts b/src/utils/get-sorted-nodes-by-import-order.ts index 5450df7e..7aa0e9ea 100644 --- a/src/utils/get-sorted-nodes-by-import-order.ts +++ b/src/utils/get-sorted-nodes-by-import-order.ts @@ -1,4 +1,4 @@ -import { clone } from 'lodash'; +import { clone } from 'lodash-es'; import { THIRD_PARTY_MODULES_SPECIAL_WORD, newLineNode, SEPARATOR_SPECIAL_WORD } from '../constants'; import { naturalSort } from '../natural-sort'; diff --git a/test-setup/raw-serializer.cjs b/test-setup/raw-serializer.mjs similarity index 93% rename from test-setup/raw-serializer.cjs rename to test-setup/raw-serializer.mjs index 20c66071..2e6fdefc 100644 --- a/test-setup/raw-serializer.cjs +++ b/test-setup/raw-serializer.mjs @@ -2,7 +2,7 @@ const RAW = Symbol.for('raw'); -module.exports = { +export default { print(val) { return val[RAW]; }, diff --git a/test-setup/run_spec.cjs b/test-setup/run_spec.mjs similarity index 88% rename from test-setup/run_spec.cjs rename to test-setup/run_spec.mjs index 118d9943..a4eb7453 100644 --- a/test-setup/run_spec.cjs +++ b/test-setup/run_spec.mjs @@ -1,14 +1,14 @@ 'use strict'; -const fs = require('fs'); -const extname = require('path').extname; -const prettier = require('prettier'); -const plugin = require('../src'); +import fs from 'fs'; +import { extname } from 'path'; +import prettier from 'prettier'; +import plugin from '../src/'; function run_spec(dirname, parsers, options) { options = Object.assign( { - plugins: [plugin.default], + plugins: [plugin], tabWidth: 4, }, options, @@ -25,6 +25,8 @@ function run_spec(dirname, parsers, options) { extname(filename) !== '.snap' && fs.lstatSync(path).isFile() && filename[0] !== '.' && + filename !== 'ppsi.spec.js' && + filename !== 'ppsi.spec.mjs' && filename !== 'ppsi.spec.cjs' ) { const source = read(path).replace(/\r\n/g, '\n'); @@ -59,6 +61,12 @@ function run_spec(dirname, parsers, options) { } }); } +import { expect } from 'vitest'; +import rawSerializer from './raw-serializer.mjs'; + +// Add custom snapshot serializer for Vitest +expect.addSnapshotSerializer(rawSerializer); + global.run_spec = run_spec; function stripLocation(ast) { diff --git a/tests/Angular/__snapshots__/ppsi.spec.cjs.snap b/tests/Angular/__snapshots__/ppsi.spec.cjs.snap index c9357cd7..6c1b0ed3 100644 --- a/tests/Angular/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/Angular/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`imports-with-decorators.js - typescript-verify: imports-with-decorators.js 1`] = ` +exports[`imports-with-decorators.js - typescript-verify > imports-with-decorators.js 1`] = ` import { Body, Controller, HttpService, Logger, Post } from "@core/common"; import { retry } from "@server/operators"; diff --git a/tests/Babel/__snapshots__/ppsi.spec.cjs.snap b/tests/Babel/__snapshots__/ppsi.spec.cjs.snap index 84c62858..b3c3cafe 100644 --- a/tests/Babel/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/Babel/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`imports-with-comments.js - babel-verify: imports-with-comments.js 1`] = ` +exports[`imports-with-comments.js - babel-verify > imports-with-comments.js 1`] = ` // I am top level comment in this file. import z from 'z'; import threeLevelRelativePath from "../../../threeLevelRelativePath"; diff --git a/tests/Flow/__snapshots__/ppsi.spec.cjs.snap b/tests/Flow/__snapshots__/ppsi.spec.cjs.snap index 0703b7dc..2ed522c6 100644 --- a/tests/Flow/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/Flow/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`imports-with-comments.js - flow-verify: imports-with-comments.js 1`] = ` +exports[`imports-with-comments.js - flow-verify > imports-with-comments.js 1`] = ` /** * @flow */ diff --git a/tests/ImportPreventSortingSideEffects/__snapshots__/ppsi.spec.cjs.snap b/tests/ImportPreventSortingSideEffects/__snapshots__/ppsi.spec.cjs.snap index fba106ea..fe63d9de 100644 --- a/tests/ImportPreventSortingSideEffects/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/ImportPreventSortingSideEffects/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`imports-with-side-effect-imports.js - typescript-verify: imports-with-side-effect-imports.js 1`] = ` +exports[`imports-with-side-effect-imports.js - typescript-verify > imports-with-side-effect-imports.js 1`] = ` // I am top level comment in this file. import thirdParty0 from "third-party0"; import something3 from "@core/something3"; diff --git a/tests/ImportsNotSeparated/__snapshots__/ppsi.spec.cjs.snap b/tests/ImportsNotSeparated/__snapshots__/ppsi.spec.cjs.snap index 79565021..8b905158 100644 --- a/tests/ImportsNotSeparated/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/ImportsNotSeparated/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`import-export-in-between.ts - typescript-verify: import-export-in-between.ts 1`] = ` +exports[`import-export-in-between.ts - typescript-verify > import-export-in-between.ts 1`] = ` import threeLevelRelativePath from "../../../threeLevelRelativePath"; import sameLevelRelativePath from "./sameLevelRelativePath"; import thirdParty from "third-party"; @@ -47,7 +47,7 @@ function add(a: number, b: number) { `; -exports[`import-export-only.ts - typescript-verify: import-export-only.ts 1`] = ` +exports[`import-export-only.ts - typescript-verify > import-export-only.ts 1`] = ` import React from 'react'; export const a = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -57,7 +57,7 @@ export const a = 1; `; -exports[`imports-with-comments.ts - typescript-verify: imports-with-comments.ts 1`] = ` +exports[`imports-with-comments.ts - typescript-verify > imports-with-comments.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -82,7 +82,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-and-third-party.ts - typescript-verify: imports-with-comments-and-third-party.ts 1`] = ` +exports[`imports-with-comments-and-third-party.ts - typescript-verify > imports-with-comments-and-third-party.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -108,7 +108,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-on-top.ts - typescript-verify: imports-with-comments-on-top.ts 1`] = ` +exports[`imports-with-comments-on-top.ts - typescript-verify > imports-with-comments-on-top.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import z from 'z'; @@ -151,7 +151,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-directives.ts - typescript-verify: imports-with-directives.ts 1`] = ` +exports[`imports-with-directives.ts - typescript-verify > imports-with-directives.ts 1`] = ` 'use strict'; 'use client'; import otherthing from "@core/otherthing"; @@ -208,7 +208,7 @@ const workletAdd = (a: number, b: number) => { `; -exports[`imports-with-file-level-comments.ts - typescript-verify: imports-with-file-level-comments.ts 1`] = ` +exports[`imports-with-file-level-comments.ts - typescript-verify > imports-with-file-level-comments.ts 1`] = ` //@ts-ignore // I am file top level comments import threeLevelRelativePath from "../../../threeLevelRelativePath"; @@ -281,7 +281,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-interpreter-directive.ts - typescript-verify: imports-with-interpreter-directive.ts 1`] = ` +exports[`imports-with-interpreter-directive.ts - typescript-verify > imports-with-interpreter-directive.ts 1`] = ` #!/usr/bin/env node import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -312,7 +312,7 @@ function add(a: number, b: number) { `; -exports[`imports-without-third-party.ts - typescript-verify: imports-without-third-party.ts 1`] = ` +exports[`imports-without-third-party.ts - typescript-verify > imports-without-third-party.ts 1`] = ` // I am top level comment import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -333,7 +333,7 @@ import twoLevelRelativePath from "../../twoLevelRelativePath"; `; -exports[`no-import-export.ts - typescript-verify: no-import-export.ts 1`] = ` +exports[`no-import-export.ts - typescript-verify > no-import-export.ts 1`] = ` function add(a:number,b:number) { return a + b; } @@ -344,7 +344,7 @@ function add(a: number, b: number) { `; -exports[`one-import.ts - typescript-verify: one-import.ts 1`] = ` +exports[`one-import.ts - typescript-verify > one-import.ts 1`] = ` // This example support/index.js is processed and // loaded automatically before your test files. // @@ -386,7 +386,7 @@ import "./commands"; `; -exports[`sort-imports-ignored.ts - typescript-verify: sort-imports-ignored.ts 1`] = ` +exports[`sort-imports-ignored.ts - typescript-verify > sort-imports-ignored.ts 1`] = ` // sort-imports-ignore import './commands'; diff --git a/tests/ImportsNotSeparatedRest/__snapshots__/ppsi.spec.cjs.snap b/tests/ImportsNotSeparatedRest/__snapshots__/ppsi.spec.cjs.snap index ecc8d513..5e70bc36 100644 --- a/tests/ImportsNotSeparatedRest/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/ImportsNotSeparatedRest/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`import-export-in-between.ts - typescript-verify: import-export-in-between.ts 1`] = ` +exports[`import-export-in-between.ts - typescript-verify > import-export-in-between.ts 1`] = ` import threeLevelRelativePath from "../../../threeLevelRelativePath"; import sameLevelRelativePath from "./sameLevelRelativePath"; import thirdParty from "third-party"; @@ -47,7 +47,7 @@ function add(a: number, b: number) { `; -exports[`import-export-only.ts - typescript-verify: import-export-only.ts 1`] = ` +exports[`import-export-only.ts - typescript-verify > import-export-only.ts 1`] = ` import React from 'react'; export const a = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -57,7 +57,7 @@ export const a = 1; `; -exports[`imports-with-comments.ts - typescript-verify: imports-with-comments.ts 1`] = ` +exports[`imports-with-comments.ts - typescript-verify > imports-with-comments.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -82,7 +82,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-and-third-party.ts - typescript-verify: imports-with-comments-and-third-party.ts 1`] = ` +exports[`imports-with-comments-and-third-party.ts - typescript-verify > imports-with-comments-and-third-party.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -108,7 +108,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-on-top.ts - typescript-verify: imports-with-comments-on-top.ts 1`] = ` +exports[`imports-with-comments-on-top.ts - typescript-verify > imports-with-comments-on-top.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import z from 'z'; @@ -151,7 +151,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-file-level-comments.ts - typescript-verify: imports-with-file-level-comments.ts 1`] = ` +exports[`imports-with-file-level-comments.ts - typescript-verify > imports-with-file-level-comments.ts 1`] = ` //@ts-ignore // I am file top level comments import threeLevelRelativePath from "../../../threeLevelRelativePath"; @@ -224,7 +224,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-interpreter-directive.ts - typescript-verify: imports-with-interpreter-directive.ts 1`] = ` +exports[`imports-with-interpreter-directive.ts - typescript-verify > imports-with-interpreter-directive.ts 1`] = ` #!/usr/bin/env node import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -255,7 +255,7 @@ function add(a: number, b: number) { `; -exports[`imports-without-third-party.ts - typescript-verify: imports-without-third-party.ts 1`] = ` +exports[`imports-without-third-party.ts - typescript-verify > imports-without-third-party.ts 1`] = ` // I am top level comment import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -276,7 +276,7 @@ import twoLevelRelativePath from "../../twoLevelRelativePath"; `; -exports[`no-import-export.ts - typescript-verify: no-import-export.ts 1`] = ` +exports[`no-import-export.ts - typescript-verify > no-import-export.ts 1`] = ` function add(a:number,b:number) { return a + b; } @@ -287,7 +287,7 @@ function add(a: number, b: number) { `; -exports[`one-import.ts - typescript-verify: one-import.ts 1`] = ` +exports[`one-import.ts - typescript-verify > one-import.ts 1`] = ` // This example support/index.js is processed and // loaded automatically before your test files. // @@ -329,7 +329,7 @@ import "./commands"; `; -exports[`sort-imports-ignored.ts - typescript-verify: sort-imports-ignored.ts 1`] = ` +exports[`sort-imports-ignored.ts - typescript-verify > sort-imports-ignored.ts 1`] = ` // sort-imports-ignore import './commands'; diff --git a/tests/ImportsSeparated/__snapshots__/ppsi.spec.cjs.snap b/tests/ImportsSeparated/__snapshots__/ppsi.spec.cjs.snap index bb5d393f..aa22efad 100644 --- a/tests/ImportsSeparated/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/ImportsSeparated/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`import-export-in-between.ts - typescript-verify: import-export-in-between.ts 1`] = ` +exports[`import-export-in-between.ts - typescript-verify > import-export-in-between.ts 1`] = ` import threeLevelRelativePath from "../../../threeLevelRelativePath"; import sameLevelRelativePath from "./sameLevelRelativePath"; import thirdParty from "third-party"; @@ -51,7 +51,7 @@ function add(a: number, b: number) { `; -exports[`import-export-only.ts - typescript-verify: import-export-only.ts 1`] = ` +exports[`import-export-only.ts - typescript-verify > import-export-only.ts 1`] = ` import React from 'react'; export const a = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -61,7 +61,7 @@ export const a = 1; `; -exports[`import-with-type-imports-together.ts - typescript-verify: import-with-type-imports-together.ts 1`] = ` +exports[`import-with-type-imports-together.ts - typescript-verify > import-with-type-imports-together.ts 1`] = ` import { foo } from "@server/foo" import type { Quux } from "./quux" import { Link } from "@ui/Link" @@ -80,7 +80,7 @@ import type { Quux } from "./quux"; `; -exports[`imports-with-comments.ts - typescript-verify: imports-with-comments.ts 1`] = ` +exports[`imports-with-comments.ts - typescript-verify > imports-with-comments.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -105,7 +105,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-and-third-party.ts - typescript-verify: imports-with-comments-and-third-party.ts 1`] = ` +exports[`imports-with-comments-and-third-party.ts - typescript-verify > imports-with-comments-and-third-party.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -132,7 +132,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-on-top.ts - typescript-verify: imports-with-comments-on-top.ts 1`] = ` +exports[`imports-with-comments-on-top.ts - typescript-verify > imports-with-comments-on-top.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import z from 'z'; @@ -179,7 +179,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-directives.ts - typescript-verify: imports-with-directives.ts 1`] = ` +exports[`imports-with-directives.ts - typescript-verify > imports-with-directives.ts 1`] = ` 'use strict'; 'use client'; @@ -244,7 +244,7 @@ const workletAdd = (a: number, b: number) => { `; -exports[`imports-with-file-level-comments.ts - typescript-verify: imports-with-file-level-comments.ts 1`] = ` +exports[`imports-with-file-level-comments.ts - typescript-verify > imports-with-file-level-comments.ts 1`] = ` //@ts-ignore // I am file top level comments import threeLevelRelativePath from "../../../threeLevelRelativePath"; @@ -321,7 +321,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-interpreter-directive.ts - typescript-verify: imports-with-interpreter-directive.ts 1`] = ` +exports[`imports-with-interpreter-directive.ts - typescript-verify > imports-with-interpreter-directive.ts 1`] = ` #!/usr/bin/env node import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -355,7 +355,7 @@ function add(a: number, b: number) { `; -exports[`imports-without-third-party.ts - typescript-verify: imports-without-third-party.ts 1`] = ` +exports[`imports-without-third-party.ts - typescript-verify > imports-without-third-party.ts 1`] = ` // I am top level comment import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -379,7 +379,7 @@ import twoLevelRelativePath from "../../twoLevelRelativePath"; `; -exports[`no-import-export.ts - typescript-verify: no-import-export.ts 1`] = ` +exports[`no-import-export.ts - typescript-verify > no-import-export.ts 1`] = ` function add(a:number,b:number) { return a + b; } @@ -390,7 +390,7 @@ function add(a: number, b: number) { `; -exports[`one-import.ts - typescript-verify: one-import.ts 1`] = ` +exports[`one-import.ts - typescript-verify > one-import.ts 1`] = ` // This example support/index.js is processed and // loaded automatically before your test files. // @@ -432,7 +432,7 @@ import "./commands"; `; -exports[`sort-imports-ignored.ts - typescript-verify: sort-imports-ignored.ts 1`] = ` +exports[`sort-imports-ignored.ts - typescript-verify > sort-imports-ignored.ts 1`] = ` // sort-imports-ignore import './commands'; diff --git a/tests/ImportsSeparatedByUser/__snapshots__/ppsi.spec.js.snap b/tests/ImportsSeparatedByUser/__snapshots__/ppsi.spec.js.snap index b83765d9..dc904a1c 100644 --- a/tests/ImportsSeparatedByUser/__snapshots__/ppsi.spec.js.snap +++ b/tests/ImportsSeparatedByUser/__snapshots__/ppsi.spec.js.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`import-export-in-between.ts - typescript-verify: import-export-in-between.ts 1`] = ` +exports[`import-export-in-between.ts - typescript-verify > import-export-in-between.ts 1`] = ` import threeLevelRelativePath from "../../../threeLevelRelativePath"; import sameLevelRelativePath from "./sameLevelRelativePath"; import thirdParty from "third-party"; @@ -48,7 +48,7 @@ function add(a: number, b: number) { `; -exports[`import-export-only.ts - typescript-verify: import-export-only.ts 1`] = ` +exports[`import-export-only.ts - typescript-verify > import-export-only.ts 1`] = ` import React from 'react'; export const a = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -58,7 +58,7 @@ export const a = 1; `; -exports[`import-with-type-imports-together.ts - typescript-verify: import-with-type-imports-together.ts 1`] = ` +exports[`import-with-type-imports-together.ts - typescript-verify > import-with-type-imports-together.ts 1`] = ` import { foo } from "@server/foo" import type { Quux } from "./quux" import { Link } from "@ui/Link" @@ -76,7 +76,7 @@ import type { Quux } from "./quux"; `; -exports[`imports-with-comments.ts - typescript-verify: imports-with-comments.ts 1`] = ` +exports[`imports-with-comments.ts - typescript-verify > imports-with-comments.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -101,7 +101,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-and-third-party.ts - typescript-verify: imports-with-comments-and-third-party.ts 1`] = ` +exports[`imports-with-comments-and-third-party.ts - typescript-verify > imports-with-comments-and-third-party.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -128,7 +128,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-on-top.ts - typescript-verify: imports-with-comments-on-top.ts 1`] = ` +exports[`imports-with-comments-on-top.ts - typescript-verify > imports-with-comments-on-top.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import z from 'z'; @@ -172,7 +172,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-directives.ts - typescript-verify: imports-with-directives.ts 1`] = ` +exports[`imports-with-directives.ts - typescript-verify > imports-with-directives.ts 1`] = ` 'use strict'; 'use client'; @@ -237,7 +237,7 @@ const workletAdd = (a: number, b: number) => { `; -exports[`imports-with-file-level-comments.ts - typescript-verify: imports-with-file-level-comments.ts 1`] = ` +exports[`imports-with-file-level-comments.ts - typescript-verify > imports-with-file-level-comments.ts 1`] = ` //@ts-ignore // I am file top level comments import threeLevelRelativePath from "../../../threeLevelRelativePath"; @@ -311,7 +311,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-interpreter-directive.ts - typescript-verify: imports-with-interpreter-directive.ts 1`] = ` +exports[`imports-with-interpreter-directive.ts - typescript-verify > imports-with-interpreter-directive.ts 1`] = ` #!/usr/bin/env node import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -343,7 +343,7 @@ function add(a: number, b: number) { `; -exports[`imports-without-third-party.ts - typescript-verify: imports-without-third-party.ts 1`] = ` +exports[`imports-without-third-party.ts - typescript-verify > imports-without-third-party.ts 1`] = ` // I am top level comment import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -365,7 +365,7 @@ import twoLevelRelativePath from "../../twoLevelRelativePath"; `; -exports[`no-import-export.ts - typescript-verify: no-import-export.ts 1`] = ` +exports[`no-import-export.ts - typescript-verify > no-import-export.ts 1`] = ` function add(a:number,b:number) { return a + b; } @@ -376,7 +376,7 @@ function add(a: number, b: number) { `; -exports[`one-import.ts - typescript-verify: one-import.ts 1`] = ` +exports[`one-import.ts - typescript-verify > one-import.ts 1`] = ` // This example support/index.js is processed and // loaded automatically before your test files. // @@ -418,7 +418,7 @@ import "./commands"; `; -exports[`sort-imports-ignored.ts - typescript-verify: sort-imports-ignored.ts 1`] = ` +exports[`sort-imports-ignored.ts - typescript-verify > sort-imports-ignored.ts 1`] = ` // sort-imports-ignore import './commands'; diff --git a/tests/ImportsSeparatedRest/__snapshots__/ppsi.spec.cjs.snap b/tests/ImportsSeparatedRest/__snapshots__/ppsi.spec.cjs.snap index b9a6b680..b9842cbf 100644 --- a/tests/ImportsSeparatedRest/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/ImportsSeparatedRest/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`import-export-in-between.ts - typescript-verify: import-export-in-between.ts 1`] = ` +exports[`import-export-in-between.ts - typescript-verify > import-export-in-between.ts 1`] = ` import threeLevelRelativePath from "../../../threeLevelRelativePath"; import sameLevelRelativePath from "./sameLevelRelativePath"; import thirdParty from "third-party"; @@ -51,7 +51,7 @@ function add(a: number, b: number) { `; -exports[`import-export-only.ts - typescript-verify: import-export-only.ts 1`] = ` +exports[`import-export-only.ts - typescript-verify > import-export-only.ts 1`] = ` import React from 'react'; export const a = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -61,7 +61,7 @@ export const a = 1; `; -exports[`imports-with-comments.ts - typescript-verify: imports-with-comments.ts 1`] = ` +exports[`imports-with-comments.ts - typescript-verify > imports-with-comments.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -86,7 +86,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-and-third-party.ts - typescript-verify: imports-with-comments-and-third-party.ts 1`] = ` +exports[`imports-with-comments-and-third-party.ts - typescript-verify > imports-with-comments-and-third-party.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import './commands'; @@ -113,7 +113,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-comments-on-top.ts - typescript-verify: imports-with-comments-on-top.ts 1`] = ` +exports[`imports-with-comments-on-top.ts - typescript-verify > imports-with-comments-on-top.ts 1`] = ` // I am top level comment in this file. // I am second line of top level comment in this file. import z from 'z'; @@ -160,7 +160,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-file-level-comments.ts - typescript-verify: imports-with-file-level-comments.ts 1`] = ` +exports[`imports-with-file-level-comments.ts - typescript-verify > imports-with-file-level-comments.ts 1`] = ` //@ts-ignore // I am file top level comments import threeLevelRelativePath from "../../../threeLevelRelativePath"; @@ -237,7 +237,7 @@ function add(a: number, b: number) { `; -exports[`imports-with-interpreter-directive.ts - typescript-verify: imports-with-interpreter-directive.ts 1`] = ` +exports[`imports-with-interpreter-directive.ts - typescript-verify > imports-with-interpreter-directive.ts 1`] = ` #!/usr/bin/env node import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -271,7 +271,7 @@ function add(a: number, b: number) { `; -exports[`imports-without-third-party.ts - typescript-verify: imports-without-third-party.ts 1`] = ` +exports[`imports-without-third-party.ts - typescript-verify > imports-without-third-party.ts 1`] = ` // I am top level comment import otherthing from "@core/otherthing"; import abc from "@core/abc"; @@ -295,7 +295,7 @@ import twoLevelRelativePath from "../../twoLevelRelativePath"; `; -exports[`no-import-export.ts - typescript-verify: no-import-export.ts 1`] = ` +exports[`no-import-export.ts - typescript-verify > no-import-export.ts 1`] = ` function add(a:number,b:number) { return a + b; } @@ -306,7 +306,7 @@ function add(a: number, b: number) { `; -exports[`one-import.ts - typescript-verify: one-import.ts 1`] = ` +exports[`one-import.ts - typescript-verify > one-import.ts 1`] = ` // This example support/index.js is processed and // loaded automatically before your test files. // @@ -348,7 +348,7 @@ import "./commands"; `; -exports[`sort-imports-ignored.ts - typescript-verify: sort-imports-ignored.ts 1`] = ` +exports[`sort-imports-ignored.ts - typescript-verify > sort-imports-ignored.ts 1`] = ` // sort-imports-ignore import './commands'; diff --git a/tests/ImportsWithAttributesKeyword/__snapshots__/ppsi.spec.cjs.snap b/tests/ImportsWithAttributesKeyword/__snapshots__/ppsi.spec.cjs.snap index 7972df24..bb99c506 100644 --- a/tests/ImportsWithAttributesKeyword/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/ImportsWithAttributesKeyword/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`imports-with-attributes-keyword.ts - typescript-verify: imports-with-attributes-keyword.ts 1`] = ` +exports[`imports-with-attributes-keyword.ts - typescript-verify > imports-with-attributes-keyword.ts 1`] = ` // I am top level comment in this file. import thirdParty0 from "third-party0"; import something3 from "@core/something3"; diff --git a/tests/Svelte/__snapshots__/ppsi.spec.cjs.snap b/tests/Svelte/__snapshots__/ppsi.spec.cjs.snap index 382c31fe..1010ebba 100644 --- a/tests/Svelte/__snapshots__/ppsi.spec.cjs.snap +++ b/tests/Svelte/__snapshots__/ppsi.spec.cjs.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`module.svelte - svelte-verify: module.svelte 1`] = ` +exports[`module.svelte - svelte-verify > module.svelte 1`] = `