Skip to content

Commit f7a3a36

Browse files
PanayotCankovHristo Hristov
authored andcommitted
Housekeeping node tests, renamed to unit-tests (NativeScript#4936)
Add parsers for the background css shorthand property, make ViewBase unit testable in node environment Add background parser and linear-gradient parser Use sticky regexes Simplify some types, introduce generic Parsed<T> instead of & TokenRange Apply each parser to return a { start, end, value } object Move the css selector parser to the css/parser and unify types Add the first steps toward building homegrown css parser Add somewhat standards compliant tokenizer, add baseline, rework and shady css parsers Enable all tests again, skip flaky perf test Improve css parser tokenizer by converting some char token types to simple string Implement 'parse a stylesheet' Add gonzales css-parser Add parseLib and css-tree perf Add a thin parser layer that will convert CSS3 tokens to values, for now output is compatible with rework Make root tsc green Return the requires of tns-core-modules to use relative paths for webpack to work Implement support for '@import 'url-string'; Fix function parser, function-token is no-longer neglected Make the style-scope be able to load from "css" and "css-ast" modules Add a loadAppCss event so theme can be added to snapshot separately from loaded
1 parent 2eba7c6 commit f7a3a36

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2872
-1278
lines changed

.vscode/launch.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "Unit Tests",
8+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
9+
"args": [ "--timeout", "999999", "--opts", "unit-tests/mocha.opts" ],
10+
"internalConsoleOptions": "openOnSessionStart",
11+
"preLaunchTask": "tsc-unit-tests"
12+
},
413
{
514
"name": "Launch on iOS",
615
"type": "nativescript",

.vscode/tasks.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,23 @@
66
"isShellCommand": true,
77
"args": ["-p", "."],
88
"showOutput": "always",
9-
"problemMatcher": "$tsc"
9+
"problemMatcher": "$tsc",
10+
"tasks": [
11+
{
12+
"taskName": "tsc-unit-tests",
13+
"problemMatcher": "$tsc",
14+
"command": "./node_modules/.bin/tsc",
15+
"args": [ "-p", "tsconfig.unit-tests.json" ]
16+
},
17+
{
18+
"taskName": "unit-tests",
19+
"command": "npm",
20+
"args": ["run", "unit-test"]
21+
},
22+
{
23+
"taskName": "unit-tests-watch",
24+
"command": "npm",
25+
"args": ["run", "unit-test-watch"]
26+
}
27+
]
1028
}

apps/references.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
/// <reference path="../tns-platform-declarations/android.d.ts" />
22
/// <reference path="../tns-platform-declarations/ios.d.ts" />
3-
4-
/// <reference path="../tns-core-modules/ui/styling/css-selector-parser.d.ts" />

gruntfile.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ module.exports = function(grunt) {
109109

110110
var nodeTestEnv = JSON.parse(JSON.stringify(process.env));
111111
nodeTestEnv.NODE_PATH = localCfg.outTnsCoreModules;
112-
localCfg.nodeTestsDir = path.join(localCfg.outDir, 'node-tests');
112+
localCfg.nodeTestsDir = path.join(localCfg.outDir, 'unit-tests');
113113
localCfg.mainPackageContent = grunt.file.readJSON(localCfg.packageJsonFilePath);
114114
localCfg.packageVersion = getPackageVersion(localCfg.packageJsonFilePath);
115115
localCfg.commitSHA = getCommitSha();
@@ -202,7 +202,7 @@ module.exports = function(grunt) {
202202
src: [
203203
"**/*.d.ts",
204204
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
205-
"!node-tests/**",
205+
"!unit-tests/**",
206206
"!org.nativescript.widgets.d.ts",
207207
"!android17.d.ts",
208208
"!**/*.android.d.ts",
@@ -255,7 +255,7 @@ module.exports = function(grunt) {
255255
'**/*',
256256
'!*.md',
257257
'!node_modules/**/*',
258-
'!node-tests/**/*',
258+
'!unit-tests/**/*',
259259
],
260260
cwd: localCfg.outDir,
261261
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
@@ -279,7 +279,7 @@ module.exports = function(grunt) {
279279
},
280280
compileAll: "npm run compile-all",
281281
setupLinks: "npm run setup",
282-
compileNodeTests: "npm run compile-node-tests",
282+
runUnitTests: "npm run unit-test",
283283
tslint: "npm run tslint",
284284
},
285285
simplemocha: {
@@ -368,7 +368,7 @@ module.exports = function(grunt) {
368368
//aliasing pack-modules for backwards compatibility
369369
grunt.registerTask("pack-modules", [
370370
"compile-modules",
371-
"node-tests",
371+
"run-unit-test",
372372
"copy:modulesPackageDef",
373373
"exec:packModules"
374374
]);
@@ -384,13 +384,9 @@ module.exports = function(grunt) {
384384
"copy:jsLibs",
385385
]);
386386

387-
grunt.registerTask("node-tests", [
387+
grunt.registerTask("run-unit-test", [
388388
"clean:nodeTests",
389-
"shell:compileNodeTests",
390-
"copy:childPackageFiles",
391-
"copy:jsLibs",
392-
"env:nodeTests",
393-
"exec:mochaNode", //spawn a new process to use the new NODE_PATH
389+
"shell:runUnitTests"
394390
]);
395391

396392
grunt.registerTask("apiref", [

node-tests/definitions/chai.d.ts

Lines changed: 0 additions & 285 deletions
This file was deleted.

0 commit comments

Comments
 (0)