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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ bundle.js
npm-debug.log
/.test/
/test/execution-tests/**/typings
!/test/**/expectedOutput-*/**
!/test/**/expectedOutput/**
!/test/**/expectedOutput-transpile/**
/**/node_modules
/dist
/test/execution-tests/**/dist
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"github.copilot.nextEditSuggestions.enabled": true,
"chat.tools.terminal.autoApprove": {
"git blame": true,
"sed": true
"sed": true,
"yarn": true,
}
}
14 changes: 0 additions & 14 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@ yarn comparison-tests -- --save-output --single-test <name> # regenerate o

> Note: test name casing must be exact when using `--single-test`.

### Seeding snapshots for a new TypeScript version

When adding support for a new TypeScript version, run:

```bash
yarn comparison-tests-generate
```

This does two things:
1. `git clean -xfd test/comparison-tests` — wipes all untracked/generated files in the test directory.
2. Runs `test/comparison-tests/stub-new-version.js`, which copies every `expectedOutput-{OLD}/` and `expectedOutput-transpile-{OLD}/` folder to the corresponding `expectedOutput-{NEW}/` counterpart across all test sub-directories.

The `OLD_VERSION` and `NEW_VERSION` constants at the top of `stub-new-version.js` must be updated manually before running this script each time a new TypeScript version is introduced. After running, review and commit the seeded snapshots, then use `--save-output` to correct any that differ from the new version's actual output.

## Execution tests (`test/execution-tests/`)

Each sub-directory is a mini webpack project with a Karma/Jasmine test suite. The harness compiles the project and **runs the compiled code** — useful for asserting correct runtime behaviour. These are matrix-tested in CI across Node 20/22 and TypeScript 5.x versions.
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"build": "tsc --version && tsc --project \"./src\"",
"lint": "tsc --project \"./src\" --noEmit && eslint -c .eslintrc.js --ext .ts ./src",
"comparison-tests": "git clean -xfd test/comparison-tests && npm link --legacy-peer-deps ./test/comparison-tests/testLib && node test/comparison-tests/run-tests.js",
"comparison-tests-generate": "git clean -xfd test/comparison-tests && node test/comparison-tests/stub-new-version.js",
"execution-tests": "git clean -xfd test/execution-tests && node test/execution-tests/run-tests.js",
"test": "git clean -xfd test/comparison-tests && git clean -xfd test/execution-tests && node test/run-tests.js",
"clean": "git clean -xfd test/comparison-tests && git clean -xfd test/execution-tests",
Expand Down
13 changes: 6 additions & 7 deletions test/comparison-tests/create-and-execute-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ if (saveOutputMode) {
console.log('Will save output as --save-output was supplied...');
}

const typescriptVersion = semver.major(typescript.version) + '.' + semver.minor(typescript.version);
const FLAKY = '_FLAKY_';
const IGNORE = '_IGNORE_';

Expand Down Expand Up @@ -144,12 +143,12 @@ function createPaths(stagingPath, test, options) {
const testStagingPath = path.join(stagingPath, test + (options.transpileOnly ? '.transpile' : ''));
rimraf.sync(testStagingPath); // Make sure it's clean

const transpilePath = options.transpileOnly ? 'transpile-' : '';
const transpilePath = options.transpileOnly ? 'expectedOutput-transpile' : 'expectedOutput';
return {
testStagingPath: testStagingPath,
actualOutput: path.join(testStagingPath, 'actualOutput'),
expectedOutput: path.join(testStagingPath, 'expectedOutput-' + transpilePath + typescriptVersion),
originalExpectedOutput: path.join(testPath, 'expectedOutput-' + transpilePath + typescriptVersion),
expectedOutput: path.join(testStagingPath, transpilePath),
originalExpectedOutput: path.join(testPath, transpilePath),
outputPath: testStagingPath,
};
}
Expand Down Expand Up @@ -213,11 +212,11 @@ function createWebpackWatchHandler(done, paths, testState, options, test) {
function setPathsAndGetPatch(paths, testState, options) {
let patch = '';
if (testState.iteration > 0) {
const transpilePath = options.transpileOnly ? 'transpile-' : '';
const transpilePath = options.transpileOnly ? 'expectedOutput-transpile' : 'expectedOutput';
patch = 'patch' + (testState.iteration - 1);
paths.actualOutput = path.join(paths.testStagingPath, 'actualOutput', patch);
paths.expectedOutput = path.join(paths.testStagingPath, 'expectedOutput-' + transpilePath + typescriptVersion, patch);
paths.originalExpectedOutput = path.join(testPath, 'expectedOutput-' + transpilePath + typescriptVersion, patch)
paths.expectedOutput = path.join(paths.testStagingPath, transpilePath, patch);
paths.originalExpectedOutput = path.join(testPath, transpilePath, patch);
mkdirp.sync(paths.actualOutput);
mkdirp.sync(paths.expectedOutput);
if (saveOutputMode) mkdirp.sync(paths.originalExpectedOutput);
Expand Down
Loading