Skip to content

Commit 2fc08e6

Browse files
committed
fix: fix tests
1 parent 1b21f03 commit 2fc08e6

File tree

7 files changed

+33
-20
lines changed

7 files changed

+33
-20
lines changed

lib/project.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export default class Project {
101101
const Broccoli = require('broccoli').Builder;
102102
let broccoli = new Broccoli(tree);
103103
let results = await broccoli.build();
104-
await this.finishBuild(results, destDir);
104+
this.finishBuild(results, destDir);
105105
debug('project build finished');
106106
spinner.succeed(`${ this.pkg.name } build complete (${ timer.stop() }s)`);
107107
} catch (err) {

lib/spinner.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function flushQueue() {
6464
childChannel.ref();
6565
try {
6666
childSpinner.send(nextOperation);
67-
} catch(e) {
67+
} catch (e) {
6868
// most likely the child process is dead because it
6969
// received the sigint while this process was blocked
7070
// on some build step - we're likely about to shut
@@ -89,9 +89,9 @@ export function wrapOutputStream(stream: Writable) {
8989
if (spinnerIsActive) {
9090
readline.clearLine(mockOriginalStream, 0);
9191
readline.cursorTo(mockOriginalStream, 0);
92-
chunk = chunk.toString();
93-
if (!chunk.endsWith('\n')) {
94-
chunk = chunk + '\n';
92+
let chunkStr = chunk.toString();
93+
if (!chunkStr.endsWith('\n')) {
94+
chunkStr = `${ chunkStr }\n`;
9595
}
9696
}
9797
return originalWrite(chunk, encoding, callback);

lib/utils/globify.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export default function globify(dirs: string[]) {
22
return dirs.map((dir) => `${ dir }/**/*`);
3-
}
3+
}

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"name": "denali-cli",
33
"version": "0.0.20",
4-
"description": "The official CLI for starting, building, and running Denali apps and addons",
4+
"description": "The official CLI for creating, building, and running Denali apps and addons",
55
"homepage": "http://denali.js.org",
66
"repository": "denali-js/denali-cli",
77
"author": {
88
"name": "Dave Wasmer",
99
"email": "davewasmer@gmail.com",
10-
"url": "davewasmer.com"
10+
"url": "http://davewasmer.com"
1111
},
1212
"bin": {
1313
"denali": "dist/bin/denali"
1414
},
1515
"main": "dist/lib/index.js",
1616
"engines": {
17-
"node": ">=7"
17+
"node": ">=7.6"
1818
},
1919
"files": [
2020
"dist"
@@ -41,7 +41,7 @@
4141
"build:bin": "mv dist/bin/denali.js dist/bin/denali && chmod +x dist/bin/denali",
4242
"build:templates": "cp -r lib/templates dist/lib/templates",
4343
"prepublishOnly": "npm run build",
44-
"lint": "! tslint --project tsconfig.json -c tslint.json --type-check | sed \"s|$PWD/||\" | grep ERROR",
44+
"lint": "! tslint --project tsconfig.json -c tslint.json | sed \"s|$PWD/||\" | grep ERROR",
4545
"test": "npm run lint && npm run build && nyc ava dist/test/acceptance"
4646
},
4747
"license": "MIT",

test/acceptance/commands/addon-test.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ import test from 'ava';
33
import { each } from 'lodash';
44
import * as path from 'path';
55
import * as fs from 'fs-extra';
6+
import * as tmp from 'tmp';
67
import CliAcceptanceTest from '../../utils/cli-acceptance';
78

89
test('generates an addon', async (t) => {
9-
let addonCommand = new CliAcceptanceTest('addon denali-new-addon', { populateWithDummy: false, name: 'new-command' });
10+
let addonCommand = new CliAcceptanceTest('addon denali-new-addon', {
11+
populateWithDummy: false,
12+
name: 'addon-command',
13+
dir: tmp.dirSync({
14+
unsafeCleanup: true,
15+
prefix: `addon-command`
16+
}).name
17+
});
18+
await addonCommand.run({ failOnStderr: true });
19+
1020
let filesToCheck = {
1121
'app/addon.js': 'addon main file',
1222
'.gitignore': '.gitignore',
1323
'test/dummy/app/application.js': 'dummy app file'
1424
};
15-
16-
await addonCommand.run({ failOnStderr: true });
1725
each(filesToCheck, (description, file) => {
1826
let pathToCheck = path.join(addonCommand.dir, 'denali-new-addon', file);
1927
t.true(fs.existsSync(pathToCheck), `${ description } should be generated`);

test/acceptance/commands/new-test.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@
22
import test from 'ava';
33
import * as path from 'path';
44
import * as fs from 'fs-extra';
5+
import * as tmp from 'tmp';
56
import CliAcceptanceTest from '../../utils/cli-acceptance';
67

78
test('generates an app', async (t) => {
8-
let newCommand = new CliAcceptanceTest('new my-denali-app', { populateWithDummy: false, name: 'new-command' });
9-
let generatedFilepath = path.join(newCommand.dir, 'my-denali-app', 'app', 'application.js');
10-
let gitignorePath = path.join(newCommand.dir, 'my-denali-app', '.gitignore');
11-
9+
let newCommand = new CliAcceptanceTest('new my-denali-app', {
10+
populateWithDummy: false,
11+
name: 'new-command',
12+
dir: tmp.dirSync({
13+
unsafeCleanup: true,
14+
prefix: `new-command`
15+
}).name
16+
});
1217
await newCommand.run({ failOnStderr: true });
18+
19+
let generatedFilepath = path.join(newCommand.dir, 'my-denali-app', 'app', 'application.js');
1320
t.true(fs.existsSync(generatedFilepath), 'file should be generated');
21+
let gitignorePath = path.join(newCommand.dir, 'my-denali-app', '.gitignore');
1422
t.true(fs.existsSync(gitignorePath), 'gitignore should be generated');
1523
});

tslint.json

-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"arrow-return-shorthand": true,
77
"class-name": true,
88
"comment-format": [ true, "check-space" ],
9-
"completed-docs": [ true, "classes", "functions", "methods", "properties" ],
109
"curly": true,
1110
"eofline": true,
1211
"import-spacing": true,
@@ -32,7 +31,6 @@
3231
"no-empty-interface": true,
3332
"no-empty": true,
3433
"no-eval": true,
35-
"no-floating-promises": true,
3634
"no-for-in-array": true,
3735
"no-inferrable-types": [ true, "ignore-params" ],
3836
"no-internal-module": true,
@@ -77,7 +75,6 @@
7775
"variable-declaration": "onespace"
7876
}
7977
],
80-
"typeof-compare": true,
8178
"unified-signatures": true,
8279
"use-isnan": true,
8380
"whitespace": [ true, "check-branch", "check-decl", "check-operator", "check-module", "check-separator", "check-type" ]

0 commit comments

Comments
 (0)