Skip to content

Commit af59e6f

Browse files
committed
chore: disable yarn test
Signed-off-by: Francisco Buceta <frbuceta@gmail.com>
1 parent adad8d4 commit af59e6f

File tree

1 file changed

+67
-65
lines changed

1 file changed

+67
-65
lines changed

packages/cli/test/acceptance/app-run.acceptance.js

Lines changed: 67 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const {skipIf} = require('@loopback/testlab');
2828
* a local machine, you can force this test to run by setting `CI` environment
2929
* variable.
3030
*/
31-
skipIf(process.env.CI == null, describe, 'app-generator (SLOW)', function () {
31+
skipIf(process.env.CI == null, describe, 'app-generator (SLOW)', () => {
3232
const appProps = {
3333
name: '@loopback/sandbox-app',
3434
description: 'My sandbox app for LoopBack 4',
@@ -89,73 +89,75 @@ skipIf(process.env.CI == null, describe, 'app-generator (SLOW)', function () {
8989
}
9090
});
9191

92-
const isYarnAvailable = utils.isYarnAvailable();
93-
const yarnTest = isYarnAvailable ? describe : describe.skip;
94-
95-
yarnTest('app-generator with Yarn (SLOW)', () => {
96-
const appProps = {
97-
name: '@loopback/sandbox-yarn-app',
98-
description: 'My sandbox app with Yarn for LoopBack 4',
99-
outdir: path.join(sandboxDir, 'sandbox-yarn-app'),
100-
};
101-
102-
before('scaffold a new application', createAppProject);
103-
/** @this {Mocha.Context} */
104-
async function createAppProject() {
105-
// Increase the timeout to 1 minute to accommodate slow CI build machines
106-
this.timeout(60 * 1000);
107-
await helpers
108-
.run(appGenerator)
109-
.inDir(appProps.outdir)
110-
// Mark it private to prevent accidental npm publication
111-
.withOptions({
112-
applicationName: 'YarnApp',
113-
packageManager: 'yarn',
114-
private: true,
115-
})
116-
.withPrompts(appProps);
117-
}
118-
119-
before('install dependencies', installDependencies);
120-
/** @this {Mocha.Context} */
121-
async function installDependencies() {
122-
// Run `lerna bootstrap --scope @loopback/sandbox-app --include-filtered-dependencies`
123-
// WARNING: It takes a while to run `lerna bootstrap`
124-
this.timeout(15 * 60 * 1000);
125-
process.chdir(rootDir);
126-
await lernaBootstrap('yarn', appProps.name);
127-
}
128-
129-
it('passes `yarn test` for the generated project', /** @this {Mocha.Context} */ function () {
130-
// Increase the timeout to 5 minutes,
131-
// the tests can take more than 2 seconds to run.
132-
this.timeout(5 * 60 * 1000);
133-
134-
return new Promise((resolve, reject) => {
135-
build
136-
.runShell('yarn', ['test'], {
137-
// Disable stdout
138-
stdio: [process.stdin, 'ignore', process.stderr],
139-
cwd: appProps.outdir,
92+
skipIf(
93+
!utils.isYarnAvailable() || process.env.CI === true,
94+
describe,
95+
'app-generator with Yarn (SLOW)',
96+
() => {
97+
const appProps = {
98+
name: '@loopback/sandbox-yarn-app',
99+
description: 'My sandbox app with Yarn for LoopBack 4',
100+
outdir: path.join(sandboxDir, 'sandbox-yarn-app'),
101+
};
102+
103+
before('scaffold a new application', createAppProject);
104+
/** @this {Mocha.Context} */
105+
async function createAppProject() {
106+
// Increase the timeout to 1 minute to accommodate slow CI build machines
107+
this.timeout(60 * 1000);
108+
await helpers
109+
.run(appGenerator)
110+
.inDir(appProps.outdir)
111+
// Mark it private to prevent accidental npm publication
112+
.withOptions({
113+
applicationName: 'YarnApp',
114+
packageManager: 'yarn',
115+
private: true,
140116
})
141-
.on('close', code => {
142-
assert.equal(code, 0);
143-
resolve();
144-
});
117+
.withPrompts(appProps);
118+
}
119+
120+
before('install dependencies', installDependencies);
121+
/** @this {Mocha.Context} */
122+
async function installDependencies() {
123+
// Run `lerna bootstrap --scope @loopback/sandbox-app --include-filtered-dependencies`
124+
// WARNING: It takes a while to run `lerna bootstrap`
125+
this.timeout(15 * 60 * 1000);
126+
process.chdir(rootDir);
127+
await lernaBootstrap('yarn', appProps.name);
128+
}
129+
130+
it('passes `yarn test` for the generated project', /** @this {Mocha.Context} */ function () {
131+
// Increase the timeout to 5 minutes,
132+
// the tests can take more than 2 seconds to run.
133+
this.timeout(5 * 60 * 1000);
134+
135+
return new Promise((resolve, reject) => {
136+
build
137+
.runShell('yarn', ['test'], {
138+
// Disable stdout
139+
stdio: [process.stdin, 'ignore', process.stderr],
140+
cwd: appProps.outdir,
141+
})
142+
.on('close', code => {
143+
assert.equal(code, 0);
144+
resolve();
145+
});
146+
});
145147
});
146-
});
147-
148-
after(cleanup);
149-
/** @this {Mocha.Context} */
150-
function cleanup() {
151-
// Increase the timeout to accommodate slow CI build machines
152-
this.timeout(30 * 1000);
153148

154-
process.chdir(rootDir);
155-
build.clean(['node', 'run-clean', appProps.outdir]);
156-
process.chdir(process.cwd());
157-
}
158-
});
149+
after(cleanup);
150+
/** @this {Mocha.Context} */
151+
function cleanup() {
152+
// Increase the timeout to accommodate slow CI build machines
153+
this.timeout(30 * 1000);
154+
155+
process.chdir(rootDir);
156+
build.clean(['node', 'run-clean', appProps.outdir]);
157+
process.chdir(process.cwd());
158+
}
159+
},
160+
);
159161

160162
async function lernaBootstrap(packageManager, ...scopes) {
161163
const cmd = bootstrapCommandFactory({

0 commit comments

Comments
 (0)