Skip to content

Commit

Permalink
Remove __dirname from schema2ts.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nicojs authored and hugo-vrijswijk committed Nov 16, 2023
1 parent 488a8af commit b721dc4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 10 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ Some quick notes to help you get started:

Have fun!

## Debugging mutation-testing-elements

### Unit tests

To debug the unit tests, you can place a `debugger` statement on the place you want to debug. Then, start the unit tests and open the dev tools to trigger the debug statement.

## Integration tests

Install the VS Code Playwright plugin (from the recommended extensions). Then run any test from the sidebar in a test file.

## Running Stryker on mutation-testing-elements

We support mutation testing mutation-testing-elements with Stryker! You can run it with `npx nx run PACKAGE_NAME:stryker`, for example `npx nx run elements:stryker`.
Expand Down
10 changes: 0 additions & 10 deletions packages/elements/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@
"url": "http://localhost:5173",
"webRoot": "${workspaceFolder}",
"sourceMaps": true
},
{
"type": "chrome",
"request": "attach",
"name": "Debug Unit Tests",
"address": "localhost",
"port": 9333,
"webRoot": "${workspaceFolder}",
"sourceMaps": true,
"timeout": 30000
}
]
}
6 changes: 4 additions & 2 deletions tasks/schema2ts.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { relative, resolve, dirname } from 'path';
import { resolve, dirname, relative } from 'path';
import { promises as fs } from 'fs';
import { compileFromFile } from 'json-schema-to-typescript';
import { fileURLToPath } from 'url';

const [, , src, target] = process.argv.filter((arg) => !arg.startsWith('-'));

if (!target) {
throw new Error(`Usage node ${relative(__dirname, __filename)} schema outFile`);
const fileName = fileURLToPath(import.meta.url);
throw new Error(`Usage node ${relative(process.cwd(), fileName)} schema.json out.ts`);
}

const ts = await compileFromFile(resolve(src), {
Expand Down

0 comments on commit b721dc4

Please sign in to comment.