Skip to content

Commit

Permalink
set up VS Code debugging for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mistval committed Dec 23, 2023
1 parent bbd7daa commit cd43627
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 20 deletions.
19 changes: 7 additions & 12 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,13 @@
"version": "0.2.0",
"configurations": [
{
"args": [
"--colors",
"${workspaceFolder}/test"
],
"internalConsoleOptions": "openOnSessionStart",
"name": "Mocha Tests",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"type": "node",
"request": "launch",
"skipFiles": [
"<node_internals>/**"
],
"type": "pwa-node"
"name": "Debug Tests",
"runtimeExecutable": "npm",
"runtimeArgs": ["run", "test"],
"console": "integratedTerminal",
"runtimeVersion": "20"
}
]
}
}
28 changes: 28 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
},
"scripts": {
"tsc": "tsc",
"buildcjs": "rollup ./dist/index.js --file ./dist/index.cjs --format cjs && cp ./commonjs/wrapper.cjs ./dist/wrapper.cjs",
"test": "NODE_OPTIONS=\"--loader ts-node/esm\" mocha --require ts-node/register --spec test/tests.ts --extensions ts --timeout 10000 --exit && mocha --timeout 10000 --exit test/tests.cjs",
"buildcjs": "cross-env rollup ./dist/index.js --file ./dist/index.cjs --format cjs && cp ./commonjs/wrapper.cjs ./dist/wrapper.cjs",
"test": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" mocha --require ts-node/register --spec test/tests.ts --extensions ts --timeout 10000 --exit && mocha --timeout 10000 --exit test/tests.cjs",
"test:debug": "cross-env TS_NODE_FILES=true node -r ts-node/register node_modules/.bin/mocha --spec 'test/**/*.spec.ts' --spec 'src/**/*.spec.ts' --exit --timeout 120000",
"coverage": "c8 --reporter=lcov --reporter=text --reporter=html --exclude=dist --exclude=test npm test",
"lint": "xo .",
"lintfix": "xo . --fix",
"prepublishOnly": "npm run tsc && npm run buildcjs && npm test",
"prepublishOnly": "cross-env npm run tsc && npm run buildcjs && npm test",
"prepare": "husky install"
},
"repository": {
Expand All @@ -42,6 +43,7 @@
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"c8": "^8.0.1",
"cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"husky": "^8.0.3",
"mocha": "^10.2.0",
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ function getFormDataCacheKey(formData: FormData) {
const cacheKey = { ...formData } as FormDataInternal;
const boundary = formData.getBoundary();

// TODO: Check if this property actually exists

delete cacheKey._boundary;

const boundaryReplaceRegex = new RegExp(boundary, 'g');
Expand Down
9 changes: 6 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */

/* Emit */
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
Expand Down Expand Up @@ -106,5 +106,8 @@
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"exclude": ["test"]
"ts-node": {
"esm": true,
},
"exclude": ["test", "dist"]
}

0 comments on commit cd43627

Please sign in to comment.