@adonisjs/assembler 5.5.1-0 → 5.5.2-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/ace-manifest.json +43 -5
- package/build/commands/Invoke.d.ts +9 -1
- package/build/commands/Invoke.js +103 -41
- package/build/commands/Make/Test.d.ts +35 -0
- package/build/commands/Make/Test.js +96 -0
- package/build/commands/Test.d.ts +4 -0
- package/build/commands/Test.js +9 -0
- package/build/src/Test/index.js +3 -9
- package/build/templates/test-entrypoint.txt +45 -0
- package/build/templates/test.txt +5 -0
- package/build/templates/tests-contract.txt +18 -0
- package/package.json +20 -19
package/build/ace-manifest.json
CHANGED
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
"settings": {},
|
|
52
52
|
"commandPath": "./commands/Invoke",
|
|
53
53
|
"commandName": "configure",
|
|
54
|
-
"description": "Configure
|
|
54
|
+
"description": "Configure one or more AdonisJS packages",
|
|
55
55
|
"args": [
|
|
56
56
|
{
|
|
57
|
-
"type": "
|
|
58
|
-
"propertyName": "
|
|
59
|
-
"name": "
|
|
57
|
+
"type": "spread",
|
|
58
|
+
"propertyName": "packages",
|
|
59
|
+
"name": "packages",
|
|
60
60
|
"required": true,
|
|
61
|
-
"description": "Name of the package you want to configure"
|
|
61
|
+
"description": "Name of the package(s) you want to configure"
|
|
62
62
|
}
|
|
63
63
|
],
|
|
64
64
|
"aliases": [
|
|
@@ -259,6 +259,38 @@
|
|
|
259
259
|
}
|
|
260
260
|
]
|
|
261
261
|
},
|
|
262
|
+
"make:test": {
|
|
263
|
+
"settings": {},
|
|
264
|
+
"commandPath": "./commands/Make/Test",
|
|
265
|
+
"commandName": "make:test",
|
|
266
|
+
"description": "Make a new test",
|
|
267
|
+
"args": [
|
|
268
|
+
{
|
|
269
|
+
"type": "string",
|
|
270
|
+
"propertyName": "suite",
|
|
271
|
+
"name": "suite",
|
|
272
|
+
"required": true,
|
|
273
|
+
"description": "Name of the test suite"
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"type": "string",
|
|
277
|
+
"propertyName": "name",
|
|
278
|
+
"name": "name",
|
|
279
|
+
"required": true,
|
|
280
|
+
"description": "Name of the test file"
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"aliases": [],
|
|
284
|
+
"flags": [
|
|
285
|
+
{
|
|
286
|
+
"name": "exact",
|
|
287
|
+
"propertyName": "exact",
|
|
288
|
+
"type": "boolean",
|
|
289
|
+
"description": "Create the test file with the exact name as provided",
|
|
290
|
+
"alias": "e"
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
},
|
|
262
294
|
"make:validator": {
|
|
263
295
|
"settings": {},
|
|
264
296
|
"commandPath": "./commands/Make/Validator",
|
|
@@ -371,6 +403,12 @@
|
|
|
371
403
|
],
|
|
372
404
|
"aliases": [],
|
|
373
405
|
"flags": [
|
|
406
|
+
{
|
|
407
|
+
"name": "files",
|
|
408
|
+
"propertyName": "files",
|
|
409
|
+
"type": "array",
|
|
410
|
+
"description": "Run tests for the mentioned files only"
|
|
411
|
+
},
|
|
374
412
|
{
|
|
375
413
|
"name": "watch",
|
|
376
414
|
"propertyName": "watch",
|
|
@@ -9,11 +9,19 @@ export default class Configure extends BaseCommand {
|
|
|
9
9
|
/**
|
|
10
10
|
* Use yarn when building for production to install dependencies
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
packages: string[];
|
|
13
13
|
/**
|
|
14
14
|
* Configure encore
|
|
15
15
|
*/
|
|
16
16
|
private configureEncore;
|
|
17
|
+
/**
|
|
18
|
+
* Configure tests
|
|
19
|
+
*/
|
|
20
|
+
private configureTests;
|
|
21
|
+
/**
|
|
22
|
+
* Configure a give package
|
|
23
|
+
*/
|
|
24
|
+
private configurePackage;
|
|
17
25
|
/**
|
|
18
26
|
* Invoked automatically by ace
|
|
19
27
|
*/
|
package/build/commands/Invoke.js
CHANGED
|
@@ -7,40 +7,18 @@
|
|
|
7
7
|
* For the full copyright and license information, please view the LICENSE
|
|
8
8
|
* file that was distributed with this source code.
|
|
9
9
|
*/
|
|
10
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
13
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
14
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}) : (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
o[k2] = m[k];
|
|
20
|
-
}));
|
|
21
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
22
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
23
|
-
}) : function(o, v) {
|
|
24
|
-
o["default"] = v;
|
|
25
|
-
});
|
|
26
10
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
27
11
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
28
12
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
29
13
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
30
14
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
15
|
};
|
|
32
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
33
|
-
if (mod && mod.__esModule) return mod;
|
|
34
|
-
var result = {};
|
|
35
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
36
|
-
__setModuleDefault(result, mod);
|
|
37
|
-
return result;
|
|
38
|
-
};
|
|
39
16
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
40
17
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
41
18
|
};
|
|
42
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
20
|
const path_1 = require("path");
|
|
21
|
+
const sink_1 = require("@adonisjs/sink");
|
|
44
22
|
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
45
23
|
const Manifest_1 = require("../src/Manifest");
|
|
46
24
|
/**
|
|
@@ -51,55 +29,139 @@ class Configure extends standalone_1.BaseCommand {
|
|
|
51
29
|
* Configure encore
|
|
52
30
|
*/
|
|
53
31
|
async configureEncore() {
|
|
54
|
-
const { files, logger } = await Promise.resolve().then(() => __importStar(require('@adonisjs/sink')));
|
|
55
32
|
/**
|
|
56
33
|
* Create the webpack config file
|
|
57
34
|
*/
|
|
58
|
-
const webpackConfigFile = new files.MustacheFile(this.application.appRoot, 'webpack.config.js', (0, path_1.join)(__dirname, '..', 'templates/webpack.config.txt'));
|
|
35
|
+
const webpackConfigFile = new sink_1.files.MustacheFile(this.application.appRoot, 'webpack.config.js', (0, path_1.join)(__dirname, '..', 'templates/webpack.config.txt'));
|
|
59
36
|
if (!webpackConfigFile.exists()) {
|
|
60
37
|
webpackConfigFile.apply({}).commit();
|
|
61
|
-
logger.action('create').succeeded('webpack.config.js');
|
|
38
|
+
sink_1.logger.action('create').succeeded('webpack.config.js');
|
|
62
39
|
}
|
|
63
40
|
/**
|
|
64
41
|
* Create app.js entrypoint
|
|
65
42
|
*/
|
|
66
|
-
const entryPointFile = new files.NewLineFile(this.application.appRoot, 'resources/js/app.js');
|
|
43
|
+
const entryPointFile = new sink_1.files.NewLineFile(this.application.appRoot, 'resources/js/app.js');
|
|
67
44
|
if (!entryPointFile.exists()) {
|
|
68
45
|
entryPointFile.add('// app entrypoint').commit();
|
|
69
|
-
logger.action('create').succeeded('resources/js/app.js');
|
|
46
|
+
sink_1.logger.action('create').succeeded('resources/js/app.js');
|
|
70
47
|
}
|
|
71
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Install Encore
|
|
50
|
+
*/
|
|
51
|
+
const pkgFile = new sink_1.files.PackageJsonFile(this.application.appRoot);
|
|
72
52
|
pkgFile.install('@symfony/webpack-encore');
|
|
73
|
-
const spinner = logger.await(logger.colors.gray('installing @symfony/webpack-encore'));
|
|
53
|
+
const spinner = sink_1.logger.await(sink_1.logger.colors.gray('installing @symfony/webpack-encore'));
|
|
74
54
|
try {
|
|
75
55
|
await pkgFile.commitAsync();
|
|
76
56
|
spinner.update('Installed');
|
|
57
|
+
spinner.stop();
|
|
77
58
|
}
|
|
78
59
|
catch (error) {
|
|
79
60
|
spinner.update('Unable to install the package');
|
|
80
|
-
|
|
61
|
+
spinner.stop();
|
|
62
|
+
sink_1.logger.fatal(error);
|
|
81
63
|
}
|
|
82
64
|
}
|
|
83
65
|
/**
|
|
84
|
-
*
|
|
66
|
+
* Configure tests
|
|
85
67
|
*/
|
|
86
|
-
async
|
|
87
|
-
|
|
68
|
+
async configureTests() {
|
|
69
|
+
/**
|
|
70
|
+
* Create "test.ts" file
|
|
71
|
+
*/
|
|
72
|
+
const testsEntryPointFile = new sink_1.files.MustacheFile(this.application.appRoot, 'test.ts', (0, path_1.join)(__dirname, '..', 'templates/test-entrypoint.txt'));
|
|
73
|
+
if (!testsEntryPointFile.exists()) {
|
|
74
|
+
testsEntryPointFile.apply({}).commit();
|
|
75
|
+
sink_1.logger.action('create').succeeded('test.ts');
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create "tests/bootstrap.ts" file
|
|
79
|
+
*/
|
|
80
|
+
const testsBootstrapFile = new sink_1.files.MustacheFile(this.application.appRoot, 'tests/bootstrap.ts', (0, path_1.join)(__dirname, '..', 'templates/tests/bootstrap.txt'));
|
|
81
|
+
if (!testsBootstrapFile.exists()) {
|
|
82
|
+
testsBootstrapFile.apply({}).commit();
|
|
83
|
+
sink_1.logger.action('create').succeeded('tests/bootstrap.ts');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Create "tests/functional/hello_world.spec.ts" file
|
|
87
|
+
*/
|
|
88
|
+
const helloWorldTestFile = new sink_1.files.MustacheFile(this.application.appRoot, 'tests/functional/hello_world.spec.ts', (0, path_1.join)(__dirname, '..', 'templates/tests/functional/hello_world.spec.txt'));
|
|
89
|
+
if (!helloWorldTestFile.exists()) {
|
|
90
|
+
helloWorldTestFile.apply({}).commit();
|
|
91
|
+
sink_1.logger.action('create').succeeded('tests/functional/hello_world.spec.ts');
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Create "contracts/tests.ts" file
|
|
95
|
+
*/
|
|
96
|
+
const testsContractsFile = new sink_1.files.MustacheFile(this.application.appRoot, 'contracts/tests.ts', (0, path_1.join)(__dirname, '..', 'templates/tests-contract.txt'));
|
|
97
|
+
if (!testsContractsFile.exists()) {
|
|
98
|
+
testsContractsFile.apply({}).commit();
|
|
99
|
+
sink_1.logger.action('create').succeeded('contracts/tests.ts');
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Update AdonisRc file with test suites
|
|
103
|
+
*/
|
|
104
|
+
const rcFile = new sink_1.files.AdonisRcFile(this.application.appRoot);
|
|
105
|
+
rcFile.set('tests', {
|
|
106
|
+
suites: [
|
|
107
|
+
{
|
|
108
|
+
name: 'functional',
|
|
109
|
+
files: ['tests/functional/**/*.spec(.ts|.js)'],
|
|
110
|
+
timeout: 60 * 1000,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
});
|
|
114
|
+
rcFile.commit();
|
|
115
|
+
sink_1.logger.action('update').succeeded('.adonisrc.json');
|
|
116
|
+
/**
|
|
117
|
+
* Install required dependencies
|
|
118
|
+
*/
|
|
119
|
+
const pkgFile = new sink_1.files.PackageJsonFile(this.application.appRoot);
|
|
120
|
+
pkgFile.install('@japa/runner');
|
|
121
|
+
pkgFile.install('@japa/preset-adonis');
|
|
122
|
+
const spinner = sink_1.logger.await(sink_1.logger.colors.gray('installing @japa/runner, @japa/preset-adonis'));
|
|
123
|
+
try {
|
|
124
|
+
await pkgFile.commitAsync();
|
|
125
|
+
spinner.update('Installed');
|
|
126
|
+
spinner.stop();
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
spinner.update('Unable to install packages');
|
|
130
|
+
spinner.stop();
|
|
131
|
+
sink_1.logger.fatal(error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Configure a give package
|
|
136
|
+
*/
|
|
137
|
+
async configurePackage(name) {
|
|
138
|
+
if (name === 'encore') {
|
|
88
139
|
await this.configureEncore();
|
|
89
140
|
return;
|
|
90
141
|
}
|
|
91
|
-
|
|
92
|
-
|
|
142
|
+
if (name === 'tests') {
|
|
143
|
+
await this.configureTests();
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
await new sink_1.tasks.Instructions(name, this.application.appRoot, this.application, true).execute();
|
|
93
147
|
await new Manifest_1.Manifest(this.application.appRoot, this.logger).generate();
|
|
94
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Invoked automatically by ace
|
|
151
|
+
*/
|
|
152
|
+
async run() {
|
|
153
|
+
for (let name of this.packages) {
|
|
154
|
+
await this.configurePackage(name);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
95
157
|
}
|
|
96
158
|
Configure.commandName = 'configure';
|
|
97
|
-
Configure.description = 'Configure
|
|
159
|
+
Configure.description = 'Configure one or more AdonisJS packages';
|
|
98
160
|
Configure.aliases = ['invoke'];
|
|
99
161
|
__decorate([
|
|
100
|
-
standalone_1.args.
|
|
101
|
-
description: 'Name of the package you want to configure',
|
|
162
|
+
standalone_1.args.spread({
|
|
163
|
+
description: 'Name of the package(s) you want to configure',
|
|
102
164
|
}),
|
|
103
|
-
__metadata("design:type",
|
|
104
|
-
], Configure.prototype, "
|
|
165
|
+
__metadata("design:type", Array)
|
|
166
|
+
], Configure.prototype, "packages", void 0);
|
|
105
167
|
exports.default = Configure;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseGenerator } from './Base';
|
|
2
|
+
/**
|
|
3
|
+
* Command to make a new test
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeTest extends BaseGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Required by BaseGenerator
|
|
8
|
+
*/
|
|
9
|
+
protected extname: string;
|
|
10
|
+
protected form: "singular";
|
|
11
|
+
protected pattern: "snakecase";
|
|
12
|
+
protected resourceName: string;
|
|
13
|
+
protected createExact: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Command meta data
|
|
16
|
+
*/
|
|
17
|
+
static commandName: string;
|
|
18
|
+
static description: string;
|
|
19
|
+
suite: string;
|
|
20
|
+
name: string;
|
|
21
|
+
exact: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the template stub path
|
|
24
|
+
*/
|
|
25
|
+
protected getStub(): string;
|
|
26
|
+
/**
|
|
27
|
+
* The file is created inside the parent directory of the first
|
|
28
|
+
* glob pattern
|
|
29
|
+
*/
|
|
30
|
+
protected getDestinationPath(): string;
|
|
31
|
+
protected templateData(): {
|
|
32
|
+
name: string;
|
|
33
|
+
};
|
|
34
|
+
run(): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* @adonisjs/assembler
|
|
4
|
+
*
|
|
5
|
+
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
+
*
|
|
7
|
+
* For the full copyright and license information, please view the LICENSE
|
|
8
|
+
* file that was distributed with this source code.
|
|
9
|
+
*/
|
|
10
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
20
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
const path_1 = require("path");
|
|
24
|
+
const glob_parent_1 = __importDefault(require("glob-parent"));
|
|
25
|
+
const helpers_1 = require("@poppinss/utils/build/helpers");
|
|
26
|
+
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
27
|
+
const Base_1 = require("./Base");
|
|
28
|
+
/**
|
|
29
|
+
* Command to make a new test
|
|
30
|
+
*/
|
|
31
|
+
class MakeTest extends Base_1.BaseGenerator {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/**
|
|
35
|
+
* Required by BaseGenerator
|
|
36
|
+
*/
|
|
37
|
+
this.extname = '.spec.ts';
|
|
38
|
+
this.form = 'singular';
|
|
39
|
+
this.pattern = 'snakecase';
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Returns the template stub path
|
|
43
|
+
*/
|
|
44
|
+
getStub() {
|
|
45
|
+
return (0, path_1.join)(__dirname, '..', '..', 'templates', 'test.txt');
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The file is created inside the parent directory of the first
|
|
49
|
+
* glob pattern
|
|
50
|
+
*/
|
|
51
|
+
getDestinationPath() {
|
|
52
|
+
const testSuites = this.application.rcFile.tests.suites;
|
|
53
|
+
const mentionedSuite = testSuites.find(({ name }) => this.suite === name);
|
|
54
|
+
const suiteGlob = Array.isArray(mentionedSuite.files)
|
|
55
|
+
? mentionedSuite.files[0]
|
|
56
|
+
: mentionedSuite.files;
|
|
57
|
+
return (0, glob_parent_1.default)(suiteGlob);
|
|
58
|
+
}
|
|
59
|
+
templateData() {
|
|
60
|
+
return {
|
|
61
|
+
name: helpers_1.string.sentenceCase(this.name),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async run() {
|
|
65
|
+
const testSuites = this.application.rcFile.tests.suites;
|
|
66
|
+
const mentionedSuite = testSuites.find(({ name }) => this.suite === name);
|
|
67
|
+
if (!mentionedSuite) {
|
|
68
|
+
this.logger.error(`Invalid suite "${this.suite}". Make sure the suite is registered inside the .adonisrc.json file`);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
this.resourceName = this.name;
|
|
72
|
+
this.createExact = this.exact;
|
|
73
|
+
await super.generate();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Command meta data
|
|
78
|
+
*/
|
|
79
|
+
MakeTest.commandName = 'make:test';
|
|
80
|
+
MakeTest.description = 'Make a new test';
|
|
81
|
+
__decorate([
|
|
82
|
+
standalone_1.args.string({ description: 'Name of the test suite' }),
|
|
83
|
+
__metadata("design:type", String)
|
|
84
|
+
], MakeTest.prototype, "suite", void 0);
|
|
85
|
+
__decorate([
|
|
86
|
+
standalone_1.args.string({ description: 'Name of the test file' }),
|
|
87
|
+
__metadata("design:type", String)
|
|
88
|
+
], MakeTest.prototype, "name", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
standalone_1.flags.boolean({
|
|
91
|
+
description: 'Create the test file with the exact name as provided',
|
|
92
|
+
alias: 'e',
|
|
93
|
+
}),
|
|
94
|
+
__metadata("design:type", Boolean)
|
|
95
|
+
], MakeTest.prototype, "exact", void 0);
|
|
96
|
+
exports.default = MakeTest;
|
package/build/commands/Test.d.ts
CHANGED
package/build/commands/Test.js
CHANGED
|
@@ -60,6 +60,9 @@ class Test extends standalone_1.BaseCommand {
|
|
|
60
60
|
if (this.forceExit) {
|
|
61
61
|
filters['--force-exit'] = true;
|
|
62
62
|
}
|
|
63
|
+
if (this.files) {
|
|
64
|
+
filters['--files'] = this.files;
|
|
65
|
+
}
|
|
63
66
|
if (this.timeout !== undefined) {
|
|
64
67
|
filters['--timeout'] = this.timeout;
|
|
65
68
|
}
|
|
@@ -99,6 +102,12 @@ __decorate([
|
|
|
99
102
|
standalone_1.args.spread({ description: 'Run tests for only the specified suites', required: false }),
|
|
100
103
|
__metadata("design:type", Array)
|
|
101
104
|
], Test.prototype, "suites", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
standalone_1.flags.array({
|
|
107
|
+
description: 'Run tests for the mentioned files only',
|
|
108
|
+
}),
|
|
109
|
+
__metadata("design:type", Array)
|
|
110
|
+
], Test.prototype, "files", void 0);
|
|
102
111
|
__decorate([
|
|
103
112
|
standalone_1.flags.boolean({
|
|
104
113
|
description: 'Watch for file changes and re-run tests on file change',
|
package/build/src/Test/index.js
CHANGED
|
@@ -253,9 +253,7 @@ class TestsServer {
|
|
|
253
253
|
return;
|
|
254
254
|
}
|
|
255
255
|
this.logger.action('create').succeeded(relativePath);
|
|
256
|
-
|
|
257
|
-
await this.run();
|
|
258
|
-
}
|
|
256
|
+
await this.run();
|
|
259
257
|
});
|
|
260
258
|
/**
|
|
261
259
|
* File changed
|
|
@@ -274,9 +272,7 @@ class TestsServer {
|
|
|
274
272
|
return;
|
|
275
273
|
}
|
|
276
274
|
this.logger.action('update').succeeded(relativePath);
|
|
277
|
-
|
|
278
|
-
await this.run();
|
|
279
|
-
}
|
|
275
|
+
await this.run();
|
|
280
276
|
});
|
|
281
277
|
/**
|
|
282
278
|
* File removed
|
|
@@ -301,9 +297,7 @@ class TestsServer {
|
|
|
301
297
|
return;
|
|
302
298
|
}
|
|
303
299
|
this.logger.action('delete').succeeded(relativePath);
|
|
304
|
-
|
|
305
|
-
await this.run();
|
|
306
|
-
}
|
|
300
|
+
await this.run();
|
|
307
301
|
});
|
|
308
302
|
/**
|
|
309
303
|
* Start the watcher
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|--------------------------------------------------------------------------
|
|
3
|
+
| Tests
|
|
4
|
+
|--------------------------------------------------------------------------
|
|
5
|
+
|
|
|
6
|
+
| The contents in this file boots the AdonisJS application and configures
|
|
7
|
+
| the Japa tests runner.
|
|
8
|
+
|
|
|
9
|
+
| For the most part you will never edit this file. The configuration
|
|
10
|
+
| for the tests can be controlled via ".adonisrc.json" and
|
|
11
|
+
| "tests/bootstrap.ts" files.
|
|
12
|
+
|
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
process.env.NODE_ENV = 'testing'
|
|
16
|
+
|
|
17
|
+
import 'reflect-metadata'
|
|
18
|
+
import sourceMapSupport from 'source-map-support'
|
|
19
|
+
import { Ignitor } from '@adonisjs/core/build/standalone'
|
|
20
|
+
import { configure, processCliArgs, run, RunnerHooksHandler } from '@japa/runner'
|
|
21
|
+
|
|
22
|
+
sourceMapSupport.install({ handleUncaughtExceptions: false })
|
|
23
|
+
|
|
24
|
+
const kernel = new Ignitor(__dirname).kernel('test')
|
|
25
|
+
|
|
26
|
+
kernel
|
|
27
|
+
.boot()
|
|
28
|
+
.then(() => import('./tests/bootstrap'))
|
|
29
|
+
.then(({ runnerHooks, ...config }) => {
|
|
30
|
+
const app: RunnerHooksHandler[] = [() => kernel.start()]
|
|
31
|
+
|
|
32
|
+
configure({
|
|
33
|
+
...kernel.application.rcFile.tests,
|
|
34
|
+
...processCliArgs(process.argv.slice(2)),
|
|
35
|
+
...config,
|
|
36
|
+
...{
|
|
37
|
+
importer: (filePath) => import(filePath),
|
|
38
|
+
setup: app.concat(runnerHooks.setup),
|
|
39
|
+
teardown: runnerHooks.teardown,
|
|
40
|
+
},
|
|
41
|
+
cwd: kernel.application.appRoot
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
run()
|
|
45
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract source: https://github.com/adonisjs/core/blob/master/templates/contracts/tests.txt
|
|
3
|
+
*
|
|
4
|
+
* Feel free to let us know via PR, if you find something broken in this contract
|
|
5
|
+
* file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import '@japa/runner'
|
|
9
|
+
|
|
10
|
+
declare module '@japa/runner' {
|
|
11
|
+
interface TestContext {
|
|
12
|
+
// Extend context
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Test<DataSet> {
|
|
16
|
+
// Extend test
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/assembler",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.2-0",
|
|
4
4
|
"description": "Core commands to compiler and build AdonisJs project",
|
|
5
5
|
"main": "build/ace-manifest.json",
|
|
6
6
|
"files": [
|
|
@@ -44,27 +44,27 @@
|
|
|
44
44
|
},
|
|
45
45
|
"homepage": "https://github.com/adonisjs/assembler#readme",
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@adonisjs/ace": "^11.2.
|
|
48
|
-
"@adonisjs/core": "^5.
|
|
49
|
-
"@adonisjs/mrm-preset": "^5.0.
|
|
50
|
-
"@poppinss/dev-utils": "^2.0.
|
|
51
|
-
"@types/node": "^17.0.
|
|
47
|
+
"@adonisjs/ace": "^11.2.3",
|
|
48
|
+
"@adonisjs/core": "^5.6.2",
|
|
49
|
+
"@adonisjs/mrm-preset": "^5.0.3",
|
|
50
|
+
"@poppinss/dev-utils": "^2.0.3",
|
|
51
|
+
"@types/node": "^17.0.23",
|
|
52
52
|
"commitizen": "^4.2.4",
|
|
53
53
|
"copyfiles": "^2.4.1",
|
|
54
54
|
"cross-env": "^7.0.3",
|
|
55
55
|
"cz-conventional-changelog": "^3.3.0",
|
|
56
56
|
"del-cli": "^4.0.1",
|
|
57
|
-
"eslint": "^8.
|
|
57
|
+
"eslint": "^8.12.0",
|
|
58
58
|
"eslint-config-prettier": "^8.5.0",
|
|
59
59
|
"eslint-plugin-adonis": "^2.1.0",
|
|
60
60
|
"eslint-plugin-prettier": "^4.0.0",
|
|
61
|
-
"github-label-sync": "^2.0
|
|
61
|
+
"github-label-sync": "^2.2.0",
|
|
62
62
|
"husky": "^7.0.4",
|
|
63
63
|
"japa": "^4.0.0",
|
|
64
|
-
"mrm": "^
|
|
65
|
-
"np": "^7.6.
|
|
66
|
-
"prettier": "^2.
|
|
67
|
-
"typescript": "^4.6.
|
|
64
|
+
"mrm": "^4.0.0",
|
|
65
|
+
"np": "^7.6.1",
|
|
66
|
+
"prettier": "^2.6.2",
|
|
67
|
+
"typescript": "^4.6.3"
|
|
68
68
|
},
|
|
69
69
|
"nyc": {
|
|
70
70
|
"exclude": [
|
|
@@ -89,19 +89,20 @@
|
|
|
89
89
|
"anyBranch": false
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@adonisjs/application": "^5.2.
|
|
93
|
-
"@adonisjs/env": "^3.0.
|
|
92
|
+
"@adonisjs/application": "^5.2.1",
|
|
93
|
+
"@adonisjs/env": "^3.0.8",
|
|
94
94
|
"@adonisjs/ioc-transformer": "^2.3.3",
|
|
95
|
-
"@adonisjs/require-ts": "^2.0.
|
|
95
|
+
"@adonisjs/require-ts": "^2.0.11",
|
|
96
96
|
"@adonisjs/sink": "^5.2.2",
|
|
97
|
-
"@poppinss/chokidar-ts": "^3.3.
|
|
98
|
-
"@poppinss/cliui": "^3.0.
|
|
99
|
-
"@poppinss/utils": "^4.0.
|
|
97
|
+
"@poppinss/chokidar-ts": "^3.3.5",
|
|
98
|
+
"@poppinss/cliui": "^3.0.2",
|
|
99
|
+
"@poppinss/utils": "^4.0.3",
|
|
100
100
|
"cpy": "^8.1.2",
|
|
101
|
-
"emittery": "^0.10.
|
|
101
|
+
"emittery": "^0.10.2",
|
|
102
102
|
"execa": "^5.1.1",
|
|
103
103
|
"fs-extra": "^10.0.1",
|
|
104
104
|
"get-port": "^5.1.1",
|
|
105
|
+
"glob-parent": "^6.0.2",
|
|
105
106
|
"has-yarn": "^2.1.0",
|
|
106
107
|
"picomatch": "^2.3.1",
|
|
107
108
|
"slash": "^3.0.0"
|