GeezerVison is showing github.com — test: update test426-fixtures to fae1fa49815813088c433e8486e330e8d953a44 · nodejs/node@62f8c74
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +70Lines changed: 70 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +name: CI | | 2 | + | | 3 | +on: | | 4 | + push: | | 5 | + branches: [main] | | 6 | + pull_request: | | 7 | + workflow_dispatch: | | 8 | + | | 9 | +permissions: | | 10 | + contents: read | | 11 | + | | 12 | +jobs: | | 13 | + build: | | 14 | + name: Validate tests and build npm package | | 15 | + runs-on: ubuntu-latest | | 16 | + steps: | | 17 | + - uses: actions/checkout@v6 | | 18 | + with: | | 19 | + # Fetch all to count number of commits and compute pkg version | | 20 | + fetch-depth: 0 | | 21 | + - uses: actions/setup-node@v6 | | 22 | + with: | | 23 | + node-version: lts/* | | 24 | + cache: npm | | 25 | + - name: Install dependencies | | 26 | + run: npm ci | | 27 | + - name: Build npm package | | 28 | + run: node scripts/build-npm-package.js | | 29 | + - name: Check that JSON files match their TypeScript types | | 30 | + run: node scripts/check-types.js | | 31 | + - name: Pack npm package | | 32 | + run: mkdir -p dist && npm pack ./npm-package --pack-destination dist | | 33 | + - name: Upload package tarball | | 34 | + uses: actions/upload-artifact@v7 | | 35 | + with: | | 36 | + name: npm-package | | 37 | + path: dist/*.tgz | | 38 | + if-no-files-found: error | | 39 | + retention-days: 7 | | 40 | + | | 41 | + publish: | | 42 | + name: Publish to npm | | 43 | + needs: build | | 44 | + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'tc39/source-map-tests' | | 45 | + runs-on: ubuntu-latest | | 46 | + permissions: | | 47 | + contents: read | | 48 | + id-token: write # for npm trusted publishing | | 49 | + concurrency: | | 50 | + group: npm-publish | | 51 | + cancel-in-progress: false | | 52 | + steps: | | 53 | + - uses: actions/checkout@v6 | | 54 | + with: | | 55 | + fetch-depth: 0 | | 56 | + - uses: actions/setup-node@v6 | | 57 | + with: | | 58 | + node-version: lts/* | | 59 | + registry-url: https://registry.npmjs.org | | 60 | + - name: Build npm package | | 61 | + run: node scripts/build-npm-package.js | | 62 | + - name: Publish | | 63 | + run: | | | 64 | + name=$(node -p "require('./npm-package/package.json').name") | | 65 | + version=$(node -p "require('./npm-package/package.json').version") | | 66 | + if [ -n "$(npm view "$name@$version" version 2>/dev/null)" ]; then | | 67 | + echo "$name@$version is already published, skipping." | | 68 | + else | | 69 | + npm publish ./npm-package --access public | | 70 | + fi |
Collapse file Copy file name to clipboard +6Lines changed: 6 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +npm-package/* | | 2 | +!npm-package/README.md | | 3 | +!npm-package/package.template.json | | 4 | +!npm-package/types/ | | 5 | +node_modules/ | | 6 | +.tmp/ |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test426/README.md +39Lines changed: 39 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -58,3 +58,42 @@ More information about running Chrome Devtools without building Chromium can be | 58 | 58 |
| 59 | 59 | Follow the [running Node.js tests guide](https://github.com/nodejs/node/blob/main/BUILDING.md#running-tests) to build Node.js and run tests locally. | 60 | 60 | Read more about running the source map tests at [here](https://github.com/nodejs/node/tree/main/test/test426). | | 61 | + | | 62 | +## npm package | | 63 | + | | 64 | +The test cases are published to npm as [`@tc39/source-map-tests`](https://www.npmjs.com/package/@tc39/source-map-tests), so that source map implementations can run them in their own test suites. A new version is published for every commit to `main`. | | 65 | + | | 66 | +```sh | | 67 | +npm install --save-dev --save-exact @tc39/source-map-tests | | 68 | +``` | | 69 | + | | 70 | +### Usage | | 71 | + | | 72 | +`@tc39/source-map-tests/suites.json` lists the test suites: | | 73 | + | | 74 | +```json | | 75 | +{ | | 76 | + "suites": [ | | 77 | + { "kind": "interpreting", "file": "interpreting/source-map-spec.json" }, | | 78 | + { "kind": "decoding", "file": "decoding/scopes.json" } | | 79 | + ] | | 80 | +} | | 81 | +``` | | 82 | + | | 83 | +There are two types of test suites: `interpreting` and `decoding`: | | 84 | +- **interpreting** provided a source map to apply to a generated file, together with some actions to perform through it to check that it has been applied correctly. | | 85 | +- **decoding** suites check that a source map is correctly decoded into a [Decoded Source Map Record](https://tc39.es/ecma426/#decoded-source-map-record). | | 86 | + | | 87 | +### TypeScript | | 88 | + | | 89 | +The package's root exports the types of the JSON files: | | 90 | + | | 91 | +```ts | | 92 | +import type { InterpretingSuite, DecodingSuite, TestAction } from "@tc39/source-map-tests"; | | 93 | +``` | | 94 | + | | 95 | +With TypeScript 7.1 or later, you can load type definitions for the various suites by adding `"types": ["@tc39/source-map-tests"]` to your `tsconfig.json`. Imported JSON modules then will be typed appropriately: | | 96 | +```ts | | 97 | +import spec from "@tc39/source-map-tests/interpreting/source-map-spec.json" with { type: "json" }; | | 98 | +spec.tests[0].testActions; // TestAction[] | | 99 | +``` |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test426/decoding/debug-id/debug-id-index-section.map +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | "sections": [{ | 5 | 5 | "offset": { | 6 | 6 | "line": 0, | 7 | | - "column": 0, | | 7 | + "column": 0 | 8 | 8 | }, | 9 | 9 | "map": { | 10 | 10 | "version": 3, | | 16 | 16 | }, { | 17 | 17 | "offset": { | 18 | 18 | "line": 1, | 19 | | - "column": 0, | | 19 | + "column": 0 | 20 | 20 | }, | 21 | 21 | "map": { | 22 | 22 | "version": 3, | |
Collapse file Copy file name to clipboard +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | { | 2 | 2 | "file": "app.js", | 3 | 3 | "sources": [], | 4 | | - "mappings": [], | | 4 | + "mappings": [] | 5 | 5 | } |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test426/decoding/debug-id/debug-id-index.map +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | "sections": [{ | 6 | 6 | "offset": { | 7 | 7 | "line": 0, | 8 | | - "column": 0, | | 8 | + "column": 0 | 9 | 9 | }, | 10 | 10 | "map": { | 11 | 11 | "version": 3, | | 17 | 17 | }, { | 18 | 18 | "offset": { | 19 | 19 | "line": 1, | 20 | | - "column": 0, | | 20 | + "column": 0 | 21 | 21 | }, | 22 | 22 | "map": { | 23 | 23 | "version": 3, | |
Collapse file Copy file name to clipboardExpand all lines: test/fixtures/test426/decoding/debug-id/debug-id.d.ts +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | /// <reference path="../source-map-record.d.ts" /> | 3 | 3 |
| 4 | 4 | interface SourceMapRecord { | 5 | | - debugId: string|null; | | 5 | + debugId?: string|null; | 6 | 6 | } |
Collapse file Copy file name to clipboard +5Lines changed: 5 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# @tc39/source-map-tests | | 2 | + | | 3 | +Cross-implementation test cases for the [ECMA-426 source map specification](https://tc39.es/ecma426/). | | 4 | + | | 5 | +See the [tc39/source-map-tests README](https://github.com/tc39/source-map-tests#npm-package) for the package contents and usage. |
Collapse file Copy file name to clipboard +26Lines changed: 26 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "name": "@tc39/source-map-tests", | | 3 | + "version": "X.X.X", | | 4 | + "description": "Cross-implementation test cases for the ECMA-426 source map specification", | | 5 | + "license": "BSD-3-Clause", | | 6 | + "repository": { | | 7 | + "type": "git", | | 8 | + "url": "git+https://github.com/tc39/source-map-tests.git" | | 9 | + }, | | 10 | + "homepage": "https://github.com/tc39/source-map-tests#readme", | | 11 | + "bugs": "https://github.com/tc39/source-map-tests/issues", | | 12 | + "keywords": [ | | 13 | + "source-map", | | 14 | + "sourcemap", | | 15 | + "ecma-426", | | 16 | + "test-suite", | | 17 | + "tests" | | 18 | + ], | | 19 | + "files": [ | | 20 | + "suites.json", | | 21 | + "interpreting/", | | 22 | + "decoding/", | | 23 | + "types/", | | 24 | + "LICENSE.md" | | 25 | + ] | | 26 | +} |
Collapse file Copy file name to clipboard +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +/// <reference path="./modules.d.ts" /> | | 2 | +export * from "./types.js"; |
|