Skip to content

Commit d3efd4b

Browse files
committed
chore: fix the unit tests and the linting + start executing them on prepare
1 parent 39fc99d commit d3efd4b

File tree

17 files changed

+48
-27
lines changed

17 files changed

+48
-27
lines changed

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Unit Test",
11+
"skipFiles": [
12+
"<node_internals>/**"
13+
],
14+
"program": "${workspaceRoot}/src/node_modules/mocha/bin/_mocha",
15+
"sourceMaps": true,
16+
"autoAttachChildProcesses": true,
17+
"cwd": "${workspaceRoot}/src",
18+
"args": [
19+
"test/test.es5.js"
20+
]
21+
}
22+
]
23+
}

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,6 @@ const worker = new Worker("./worker-script");
222222

223223
```
224224

225-
## Demo apps
226-
For usage with NativeScript Angular, check out [`demo-angular`](./demo-angular) in this repo.
227-
228-
For usage with NativeScript apps written in plain JavaScript, check out this repo: https://github.com/NativeScript/demo-workers.
229-
230225
## Related docs
231226

232227
1. [Workers in NativeScript](https://docs.nativescript.org/core-concepts/multithreading-model)

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ module.exports.pitch = function pitch(request) {
7171
};
7272

7373
const plugins = (pluginOptions.plugins || []).map(plugin => {
74-
if (typeof plugin !== 'string') {
74+
if (typeof plugin !== "string") {
7575
return plugin;
7676
}
7777
const found = compilerOptions.plugins.find(p => p.constructor.name === plugin);
@@ -109,7 +109,7 @@ module.exports.pitch = function pitch(request) {
109109
if (entries[0]) {
110110
const fileDeps = Array.from(childCompilation.fileDependencies);
111111
this.clearDependencies();
112-
fileDeps.map(fileName => {
112+
fileDeps.forEach(fileName => {
113113
this.addDependency(fileName);
114114
});
115115
/**

src/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"scripts": {
77
"pretest": "babel ./test/test.es6.js --out-file ./test/test.es5.js",
88
"test": "mocha test/test.es5.js",
9-
"posttest": "eslint ."
9+
"posttest": "eslint .",
10+
"prepare": "npm run test"
1011
},
1112
"eslintConfig": {
1213
"extends": "webpack",
@@ -29,6 +30,7 @@
2930
"functions": "never"
3031
}
3132
],
33+
"no-console": 0,
3234
"arrow-parens": 0,
3335
"func-names": 0,
3436
"import/no-extraneous-dependencies": 0,
@@ -48,7 +50,8 @@
4850
"babel-cli": "^6.26.0",
4951
"babel-plugin-transform-async-to-generator": "^6.24.1",
5052
"del": "^2.2.2",
51-
"eslint": "^3.16.0",
53+
"eslint": "^6.6.0",
54+
"webpack": "~4.27.0",
5255
"eslint-config-webpack": "^1.0.0",
5356
"eslint-plugin-import": "^2.2.0",
5457
"mocha": "^5.2.0"

src/symbol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

2-
const NATIVESCRIPT_WORKER_PLUGIN_SYMBOL = Symbol('NATIVESCRIPT_WORKER_PLUGIN_SYMBOL');
2+
const NATIVESCRIPT_WORKER_PLUGIN_SYMBOL = Symbol("NATIVESCRIPT_WORKER_PLUGIN_SYMBOL");
33
module.exports = NATIVESCRIPT_WORKER_PLUGIN_SYMBOL;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// w1 inlined with fallback
1+
console.log("w1 inlined with fallback");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// w2 inlined with fallback
1+
console.log("w2 inlined with fallback");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// w1 inlined via options
1+
console.log("w1 inlined via options");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// w2 inlined via options
1+
console.log("w2 inlined via options");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// inlined worker test mark
1+
console.log("inlined worker test mark");

0 commit comments

Comments
 (0)