Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: node:test not grouped with <BUILTIN_MODULES> #143

Merged
merged 6 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export const mergeableImportFlavors = [
importFlavorType,
] as const;

export const BUILTIN_MODULES_REGEX_STR = `^(?:node:)?(?:${builtinModules.join(
export const BUILTIN_MODULES_REGEX_STR = `(^(?:node:)?(?:${builtinModules.join(
'|',
)})$`;
)})$)|(^(?:node:test)$)`; // NOTE: 'test' is not included in `builtinModules` so explicitly check for "node:test"
fbartho marked this conversation as resolved.
Show resolved Hide resolved

export const BUILTIN_MODULES_SPECIAL_WORD = '<BUILTIN_MODULES>';
/**
Expand Down
25 changes: 25 additions & 0 deletions tests/BuiltinModulesNodeTest/__snapshots__/ppsi.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`groups-node-test-with-builtin-modules.js - typescript-verify > groups-node-test-with-builtin-modules.js 1`] = `
import nodeUtil from 'node:util';

import nodeNodeTestTest from 'node:node:test:test';
import nodeNodeTest from 'node:node:test';
import nodeTestTest from 'node:test:test';
import nodeTest from 'node:test';
import test from 'test'
import node from 'node';

import fs from 'fs';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import fs from "fs";
import nodeTest from "node:test";
import nodeUtil from "node:util";

import node from "node";
import nodeNodeTest from "node:node:test";
import nodeNodeTestTest from "node:node:test:test";
import nodeTestTest from "node:test:test";
import test from "test";

`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import nodeUtil from 'node:util';

import nodeNodeTestTest from 'node:node:test:test';
import nodeNodeTest from 'node:node:test';
import nodeTestTest from 'node:test:test';
import nodeTest from 'node:test';
import test from 'test'
import node from 'node';

import fs from 'fs';
12 changes: 12 additions & 0 deletions tests/BuiltinModulesNodeTest/ppsi.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {run_spec} from '../../test-setup/run_spec';

run_spec(__dirname, ["typescript"], {
importOrder: [
"",
"<BUILTIN_MODULES>",
"",
"<THIRD_PARTY_MODULES>",
"",
"^[.]",
],
});
Loading