-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(requirejs/systemjs): add protractor and jest support
- Loading branch information
1 parent
10d6ff2
commit 4648877
Showing
32 changed files
with
118 additions
and
243 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
lib/commands/new/buildsystems/cli/integration-test-runner/none.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'use strict'; | ||
|
||
module.exports = function(project) { | ||
}; |
5 changes: 5 additions & 0 deletions
5
lib/commands/new/buildsystems/cli/integration-test-runner/protractor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = function(project) { | ||
require('../../general/integration-test-runner/protractor')(project); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
'use strict'; | ||
|
||
module.exports = function(project) { | ||
require('../../general/unit-test-runners/jest')(project); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
lib/commands/new/buildsystems/general/integration-test-runner/none.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
'use strict'; | ||
|
||
module.exports = function(project) { | ||
}; |
40 changes: 40 additions & 0 deletions
40
lib/commands/new/buildsystems/general/integration-test-runner/protractor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
const ProjectItem = require('../../../../../project-item').ProjectItem; | ||
|
||
module.exports = function(project) { | ||
let configPath; | ||
|
||
if (project.model.transpiler.id === 'typescript') { | ||
project.addToDevDependencies( | ||
'ts-node' | ||
); | ||
|
||
// prevent duplicate typescript definitions | ||
if (!project.model.unitTestRunners.find(x => x.id === 'jest')) { | ||
project.addToDevDependencies('@types/jasmine'); | ||
} | ||
|
||
configPath = 'test/protractor.typescript.conf.js'; | ||
} else if (project.model.transpiler.id === 'babel') { | ||
configPath = 'test/protractor.babel.conf.js'; | ||
} | ||
|
||
project.addToTasks( | ||
ProjectItem.resource('protractor.ext', 'tasks/protractor.ext', project.model.transpiler), | ||
ProjectItem.resource('protractor.json', 'tasks/protractor.json') | ||
).addToDevDependencies( | ||
'aurelia-protractor-plugin', | ||
'protractor', | ||
'gulp-protractor', | ||
'wait-on' | ||
).addToContent( | ||
project.tests.add( | ||
project.e2eTests.add( | ||
ProjectItem.resource('demo.e2e.ext', 'test/e2e/demo.e2e.ext', project.model.transpiler), | ||
ProjectItem.resource('skeleton.po.ext', 'test/e2e/skeleton.po.ext', project.model.transpiler), | ||
ProjectItem.resource('welcome.po.ext', 'test/e2e/welcome.po.ext', project.model.transpiler) | ||
), | ||
ProjectItem.resource('protractor.conf.js', configPath) | ||
) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 1 addition & 29 deletions
30
lib/commands/new/buildsystems/webpack/integration-test-runner/protractor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,5 @@ | ||
'use strict'; | ||
const ProjectItem = require('../../../../../project-item').ProjectItem; | ||
|
||
module.exports = function(project) { | ||
let transpilerId = project.model.transpiler.id; | ||
let testContentRoot = `test/webpack/${transpilerId}`; | ||
|
||
if (project.model.transpiler.id === 'babel') { | ||
project.addToDevDependencies( | ||
'ts-node' | ||
); | ||
} | ||
|
||
project.addToDevDependencies( | ||
'aurelia-protractor-plugin', | ||
'protractor', | ||
'wait-on' | ||
).addToContent( | ||
project.tests.add( | ||
project.e2eTests.add( | ||
ProjectItem.resource('demo.e2e.ext', `${testContentRoot}/e2e/demo.e2e.ext`, project.model.transpiler), | ||
ProjectItem.resource('skeleton.po.ext', `${testContentRoot}/e2e/skeleton.po.ext`, project.model.transpiler), | ||
ProjectItem.resource('welcome.po.ext', `${testContentRoot}/e2e/welcome.po.ext`, project.model.transpiler) | ||
), | ||
ProjectItem.resource('protractor.conf.js', `${testContentRoot}/protractor.conf.js`) | ||
) | ||
); | ||
|
||
// prevent duplicate typescript definitions | ||
if (!project.model.unitTestRunner.find(x => x.id === 'jest')) { | ||
project.addToDevDependencies('@types/jasmine'); | ||
} | ||
require('../../general/integration-test-runner/protractor')(project); | ||
}; |
100 changes: 1 addition & 99 deletions
100
lib/commands/new/buildsystems/webpack/unit-test-runners/jest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,5 @@ | ||
'use strict'; | ||
const ProjectItem = require('../../../../../project-item').ProjectItem; | ||
|
||
module.exports = function(project) { | ||
let configureJasmine = require('./jasmine'); | ||
configureJasmine(project); | ||
|
||
let transpilerId = project.model.transpiler.id; | ||
let testContentRoot = `test/webpack/${transpilerId}`; | ||
|
||
project.addToTasks( | ||
ProjectItem.resource('jest.ext', 'tasks/jest.ext', project.model.transpiler), | ||
ProjectItem.resource('jest.json', 'tasks/jest.json') | ||
).addToContent( | ||
project.tests.add( | ||
ProjectItem.resource('jest-pretest.ext', `${testContentRoot}/jest-pretest.ext`, project.model.transpiler) | ||
) | ||
).addToDevDependencies( | ||
'jest', | ||
'jest-cli', | ||
'plugin-error', | ||
'aurelia-loader-nodejs', | ||
'aurelia-pal-nodejs' | ||
); | ||
|
||
if (project.model.transpiler.id === 'babel') { | ||
project.addToDevDependencies( | ||
'babel-jest' | ||
); | ||
|
||
project.package.jest = { | ||
modulePaths: [ | ||
'<rootDir>/src', | ||
'<rootDir>/node_modules' | ||
], | ||
moduleFileExtensions: [ | ||
'js', | ||
'json' | ||
], | ||
transform: { | ||
'^.+\\.jsx?$': 'babel-jest' | ||
}, | ||
testRegex: '\\.spec\\.(ts|js)x?$', | ||
setupFiles: [ | ||
'<rootDir>/test/jest-pretest.js' | ||
], | ||
testEnvironment: 'node', | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'src/**/*.{js,ts}', | ||
'!**/*.spec.{js,ts}', | ||
'!**/node_modules/**', | ||
'!**/test/**' | ||
], | ||
coverageDirectory: '<rootDir>/test/coverage-jest', | ||
coverageReporters: [ | ||
'json', | ||
'lcov', | ||
'text', | ||
'html' | ||
] | ||
}; | ||
} else if (project.model.transpiler.id === 'typescript') { | ||
project.addToDevDependencies( | ||
'ts-jest', | ||
'@types/jest' | ||
); | ||
|
||
project.package.jest = { | ||
modulePaths: [ | ||
'<rootDir>/src', | ||
'<rootDir>/node_modules' | ||
], | ||
moduleFileExtensions: [ | ||
'js', | ||
'json', | ||
'ts' | ||
], | ||
transform: { | ||
'^.+\\.(ts|tsx)$': '<rootDir>/node_modules/ts-jest/preprocessor.js' | ||
}, | ||
testRegex: '\\.spec\\.(ts|js)x?$', | ||
setupFiles: [ | ||
'<rootDir>/test/jest-pretest.ts' | ||
], | ||
testEnvironment: 'node', | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
'src/**/*.{js,ts}', | ||
'!**/*.spec.{js,ts}', | ||
'!**/node_modules/**', | ||
'!**/test/**' | ||
], | ||
coverageDirectory: '<rootDir>/test/coverage-jest', | ||
coverageReporters: [ | ||
'json', | ||
'lcov', | ||
'text', | ||
'html' | ||
] | ||
}; | ||
} | ||
require('../../general/unit-test-runners/jest')(project); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import gulp from 'gulp'; | ||
const {protractor, webdriver_update } = require('gulp-protractor'); | ||
|
||
gulp.task('webdriver_update', webdriver_update); | ||
|
||
gulp.task('protractor', (cb) => { | ||
gulp.src(['test/e2e/**/*.e2e.js'], { read: false }).pipe(protractor({ | ||
configFile: 'test/protractor.conf.js' | ||
})).on('end', cb); | ||
}); | ||
|
||
// Setting up the test task | ||
export default gulp.series( | ||
'webdriver_update', | ||
'protractor' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "protractor", | ||
"description": "Runs Protractor and reports the results. Start the application before running this task." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as gulp from 'gulp'; | ||
const {protractor, webdriver_update } = require('gulp-protractor'); | ||
|
||
gulp.task('webdriver_update', webdriver_update); | ||
|
||
gulp.task('protractor', (cb) => { | ||
gulp.src(['test/e2e/**/*.e2e.ts'], { read: false }).pipe(protractor({ | ||
configFile: 'test/protractor.conf.js' | ||
})).on('end', cb); | ||
}); | ||
|
||
// Setting up the test task | ||
export default gulp.series( | ||
'webdriver_update', | ||
'protractor' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.