Skip to content

Commit 05c5980

Browse files
committed
feat(release-check): add release-check on plugin projects
1 parent 245ce7e commit 05c5980

File tree

23 files changed

+131
-63
lines changed

23 files changed

+131
-63
lines changed

RELEASE_INSTRUCTIONS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ This is an automated testing tool for projects that were generated by the Aureli
44
1. open the terminal, go into an empty directory and run `au generate-skeletons`
55
2. from the CLI repository folder, run `gulp release-check --path C:/Development/Aurelia/TestApps --latest-cli-url aurelia/cli#master`, substituting the path with the correct one.
66
* Note, on Windows, run PowerShell with "run as administrator".
7-
3. Select for which projects you would like to run the tests
7+
3. Select for which projects you would like to run the tests.
8+
* To test all projects automatically, add `--all` to previous command.
9+
* To test subset projects automatically, add `--select requirejs,babel` (only tests projects using requirejs and babel) to previous command.
810
4. Wait until tests complete
911
5. in the CLI repository folder there is now a release-checks-results folder containing the output and other artifacts, such as screenshots. Check these screenshots to make sure that pages have rendered correctly
1012

build/tasks/release-checks/step.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const LogManager = require('aurelia-logging');
2+
const _ = require('lodash');
23

34
module.exports = class Step {
45
constructor(title) {
@@ -13,4 +14,8 @@ module.exports = class Step {
1314
getTitle() {
1415
throw new Error('not implemented');
1516
}
17+
18+
debug(message) {
19+
this.logger.debug(_.trimEnd(message));
20+
}
1621
};

build/tasks/release-checks/suite-steps.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
1+
const path = require('path');
12
const tasks = require('./tasks/index');
23
const tests = require('./tests/index');
34
const applicable = require('../../../lib/workflow/applicable');
45

56
module.exports = function(suite) {
67
const features = suite.split('_');
78
const ext = applicable(features, 'typescript') ? '.ts' : '.js';
9+
const plugin = applicable(features, 'plugin');
810

911
const steps = [
1012
new tasks.ChangeDirectory(),
1113
new tasks.InstallNodeModules(),
1214
new tasks.InstallLatestAureliaCLI(),
13-
new tests.generic.AuGenerateAttributeTests(ext),
14-
new tests.generic.AuGenerateComponentTests(ext),
15-
new tests.generic.AuGenerateElementTests(ext),
16-
new tests.generic.AuGenerateValueConverterTests(ext),
17-
new tests.generic.AuGenerateBindingBehaviorTests(ext),
18-
new tests.generic.AuGenerateTaskTests(ext),
19-
new tests.generic.AuGenerateGeneratorTests(ext)
15+
new tests.generic.AuGenerateAttributeTests(ext, plugin),
16+
new tests.generic.AuGenerateElementTests(ext, plugin),
17+
new tests.generic.AuGenerateValueConverterTests(ext, plugin),
18+
new tests.generic.AuGenerateBindingBehaviorTests(ext, plugin),
19+
new tests.generic.AuGenerateTaskTests(ext, plugin),
20+
new tests.generic.AuGenerateGeneratorTests(ext, plugin)
2021
];
2122

23+
if (!plugin) {
24+
steps.push(new tests.generic.AuGenerateComponentTests(ext));
25+
} else {
26+
steps.push(new tests.plugin.AuBuildPluginDoesNotThrowCommandLineErrors());
27+
}
2228

2329
if (applicable(features, 'jest')) {
2430
steps.push(
@@ -47,10 +53,10 @@ module.exports = function(suite) {
4753
if (applicable(features, 'cli-bundler')) {
4854
steps.push(
4955
new tests.requirejs.AuBuildDoesNotThrowCommandLineErrors(),
50-
new tests.requirejs.AuBuildWatchPicksUpFileChanges(),
56+
new tests.requirejs.AuBuildWatchPicksUpFileChanges(plugin ? path.join('dev-app', 'app.html') : undefined),
5157
new tests.requirejs.AuRunDoesNotThrowCommandLineErrors(),
5258
new tests.requirejs.AuRunLaunchesServer(),
53-
new tests.requirejs.AuRunWatchPicksUpFileChanges(),
59+
new tests.requirejs.AuRunWatchPicksUpFileChanges(plugin ? path.join('dev-app', 'app.html') : undefined),
5460
new tests.requirejs.AuRunAppLaunchesWithoutJavascriptErrors(),
5561
new tests.requirejs.AuRunRendersPage(),
5662
new tests.generic.AuLintFinishes()

build/tasks/release-checks/test-projects-selector.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const CLIOptions = require('../../../lib/cli-options').CLIOptions;
22
const cliOptions = new CLIOptions();
33
const fs = require('../../../lib/file-system');
44
const path = require('path');
5+
const _ = require('lodash');
56

67
let userArgs = process.argv.slice(2);
78
Object.assign(cliOptions, {
@@ -37,7 +38,14 @@ module.exports = class TestProjectsSelector {
3738
let dirs = await this.getSubDirs(dir);
3839

3940
if (dirs.length === 0) throw new Error('No subdirectory to test.');
40-
if (!CLIOptions.hasFlag('all')) {
41+
42+
if (cliOptions.hasFlag('select')) {
43+
const selectedFeatures = cliOptions.getFlagValue('select').split(',');
44+
dirs = dirs.filter(d => {
45+
const features = d.split('_');
46+
return _.every(selectedFeatures, f => _.includes(features, f));
47+
});
48+
} else if (!cliOptions.hasFlag('all')) {
4149
dirs = await this.choose(dirs);
4250
}
4351

@@ -49,7 +57,6 @@ module.exports = class TestProjectsSelector {
4957
options.unshift({displayName: 'All'});
5058

5159
const answers = await ui.multiselect('Found test dirs.\r\nWhich would you like to run?', options);
52-
console.log('answers', answers);
5360
return answers.includes('All') ? dirs : answers;
5461
}
5562
};

build/tasks/release-checks/tests/generic/au-cypress.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AuCypressRunsTests extends Test {
77
}
88

99
onCypressOutput(message) {
10-
this.logger.debug(message);
10+
this.debug(message);
1111

1212
if (isCypressCompletedMessage(message)) {
1313
this.success();
@@ -21,7 +21,7 @@ class AuCypressRunsTests extends Test {
2121
}
2222

2323
onOutput(message) {
24-
this.logger.debug(message);
24+
this.debug(message);
2525

2626
if (isApplicationAvailableMessage(message)) {
2727
this.cypressCommand = new ExecuteCommand('au', ['cypress', '--run'], (msg) => this.onCypressOutput(msg), (msg) => this.onCypressOutput(msg));
@@ -41,7 +41,7 @@ class AuCypressRunsTestsDotNet extends Test {
4141
}
4242

4343
onCypressOutput(message) {
44-
this.logger.debug(message);
44+
this.debug(message);
4545

4646
if (isCypressCompletedMessage(message)) {
4747
this.success();
@@ -55,7 +55,7 @@ class AuCypressRunsTestsDotNet extends Test {
5555
}
5656

5757
onOutput(message) {
58-
this.logger.debug(message);
58+
this.debug(message);
5959

6060
if (message.indexOf('Now listening on: http://localhost:') > -1) {
6161
this.cypressCommand = new ExecuteCommand('au', ['cypress'], (msg) => this.onCypressOutput(msg), (msg) => this.onCypressOutput(msg));

build/tasks/release-checks/tests/generic/au-generate.js

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ const path = require('path');
55
const _ = require('lodash');
66

77
class AuGenerateTests extends Test {
8-
constructor(objectType, ext) {
8+
constructor(objectType, ext, plugin) {
99
super(`au generate ${objectType}, writes ${objectType} file`);
1010
this.objectType = objectType;
11+
this.plugin = plugin;
1112
this.ext = ext;
1213
this.onFinish = this.onFinish.bind(this);
1314
}
1415

1516
onFinish(message) {
16-
this.logger.debug(message);
17+
this.debug(message);
1718

1819
if (_.every(this.createdFiles(), fs.isFile)) {
1920
this.success();
@@ -28,13 +29,22 @@ class AuGenerateTests extends Test {
2829
path.join('src', `new-thing${this.ext}`)
2930
];
3031
} else if (this.objectType === 'element') {
32+
if (this.plugin) {
33+
return [
34+
path.join('src', 'elements', 'new-thing.html'),
35+
path.join('src', 'elements', `new-thing${this.ext}`)
36+
];
37+
}
3138
return [
3239
path.join('src', 'resources', 'elements', 'new-thing.html'),
3340
path.join('src', 'resources', 'elements', `new-thing${this.ext}`)
3441
];
3542
} else if (this.objectType === 'task' || this.objectType === 'generator') {
3643
return [path.join('aurelia_project', this.objectType + 's', `new-thing${this.ext}`)];
3744
}
45+
if (this.plugin) {
46+
return [path.join('src', this.objectType + 's', `new-thing${this.ext}`)];
47+
}
3848
return [path.join('src', 'resources', this.objectType + 's', `new-thing${this.ext}`)];
3949
}
4050

@@ -56,44 +66,44 @@ class AuGenerateTests extends Test {
5666
}
5767

5868
class AuGenerateAttributeTests extends AuGenerateTests {
59-
constructor(ext) {
60-
super('attribute', ext);
69+
constructor(ext, plugin) {
70+
super('attribute', ext, plugin);
6171
}
6272
}
6373

6474
class AuGenerateComponentTests extends AuGenerateTests {
65-
constructor(ext) {
66-
super('component', ext);
75+
constructor(ext, plugin) {
76+
super('component', ext, plugin);
6777
}
6878
}
6979

7080
class AuGenerateElementTests extends AuGenerateTests {
71-
constructor(ext) {
72-
super('element', ext);
81+
constructor(ext, plugin) {
82+
super('element', ext, plugin);
7383
}
7484
}
7585

7686
class AuGenerateValueConverterTests extends AuGenerateTests {
77-
constructor(ext) {
78-
super('value-converter', ext);
87+
constructor(ext, plugin) {
88+
super('value-converter', ext, plugin);
7989
}
8090
}
8191

8292
class AuGenerateBindingBehaviorTests extends AuGenerateTests {
83-
constructor(ext) {
84-
super('binding-behavior', ext);
93+
constructor(ext, plugin) {
94+
super('binding-behavior', ext, plugin);
8595
}
8696
}
8797

8898
class AuGenerateTaskTests extends AuGenerateTests {
89-
constructor(ext) {
90-
super('task', ext);
99+
constructor(ext, plugin) {
100+
super('task', ext, plugin);
91101
}
92102
}
93103

94104
class AuGenerateGeneratorTests extends AuGenerateTests {
95-
constructor(ext) {
96-
super('generator', ext);
105+
constructor(ext, plugin) {
106+
super('generator', ext, plugin);
97107
}
98108
}
99109

build/tasks/release-checks/tests/generic/au-jest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AuJestRunsTests extends Test {
77
}
88

99
onOutput(message) {
10-
this.logger.debug(message);
10+
this.debug(message);
1111

1212
if (isTestFinishedMessage(message)) {
1313
this.success();

build/tasks/release-checks/tests/generic/au-karma.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AuKarmaRunsTests extends Test {
77
}
88

99
onOutput(message) {
10-
this.logger.debug(message);
10+
this.debug(message);
1111

1212
if (isTestFinishedMessage(message)) {
1313
this.success();

build/tasks/release-checks/tests/generic/au-lint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AuLintFinishes extends Test {
77
}
88

99
onOutput(message) {
10-
this.logger.debug(message);
10+
this.debug(message);
1111

1212
if (isTestFinishedMessage(message)) {
1313
this.success();

build/tasks/release-checks/tests/generic/au-protractor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class AuProtractorRunsTests extends Test {
77
}
88

99
onProtractorOutput(message) {
10-
this.logger.debug(message);
10+
this.debug(message);
1111

1212
if (isProtractorCompletedMessage(message)) {
1313
this.success();
@@ -17,7 +17,7 @@ class AuProtractorRunsTests extends Test {
1717
}
1818

1919
onOutput(message) {
20-
this.logger.debug(message);
20+
this.debug(message);
2121

2222
if (isApplicationAvailableMessage(message)) {
2323
this.protractorCommand = new ExecuteCommand('au', ['protractor'], (msg) => this.onProtractorOutput(msg));
@@ -38,7 +38,7 @@ class AuProtractorRunsTestsDotNet extends Test {
3838
}
3939

4040
onProtractorOutput(message) {
41-
this.logger.debug(message);
41+
this.debug(message);
4242

4343
if (isProtractorCompletedMessage(message)) {
4444
this.success();
@@ -48,7 +48,7 @@ class AuProtractorRunsTestsDotNet extends Test {
4848
}
4949

5050
onOutput(message) {
51-
this.logger.debug(message);
51+
this.debug(message);
5252

5353
if (message.indexOf('Now listening on: http://localhost:') > -1) {
5454
this.protractorCommand = new ExecuteCommand('au', ['protractor'], (msg) => this.onProtractorOutput(msg));

0 commit comments

Comments
 (0)