Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit d8dc5b7

Browse files
authored
Merge pull request #165 from AtomLinter/arcanemagus/asyncify-specs
Asyncify the specs
2 parents 98fd755 + 796a8b0 commit d8dc5b7

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@
5252
"devDependencies": {
5353
"eslint": "^4.6.0",
5454
"eslint-config-airbnb-base": "^12.0.0",
55-
"eslint-plugin-import": "^2.7.0"
55+
"eslint-plugin-import": "^2.7.0",
56+
"jasmine-fix": "^1.3.1"
5657
},
5758
"eslintConfig": {
5859
"rules": {

spec/.eslintrc.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
module.exports = {
2-
globals: {
3-
waitsForPromise: true
4-
},
52
env: {
6-
jasmine: true
3+
atomtest: true,
4+
jasmine: true,
5+
},
6+
rules: {
7+
"import/no-extraneous-dependencies": [
8+
"error",
9+
{
10+
"devDependencies": true
11+
}
12+
]
713
}
814
};

spec/linter-htmlhint-spec.js

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,35 @@
11
'use babel';
22

33
import * as path from 'path';
4+
// eslint-disable-next-line no-unused-vars
5+
import { it, fit, wait, beforeEach, afterEach } from 'jasmine-fix';
46

57
const { lint } = require('../lib/index.js').provideLinter();
68

79
describe('The htmlhint provider for Linter', () => {
8-
beforeEach(() => {
10+
beforeEach(async () => {
911
atom.workspace.destroyActivePaneItem();
10-
waitsForPromise(() =>
11-
Promise.all([
12-
atom.packages.activatePackage('linter-htmlhint'),
13-
atom.packages.activatePackage('language-html')
14-
]));
12+
await atom.packages.activatePackage('linter-htmlhint');
13+
await atom.packages.activatePackage('language-html');
1514
});
1615

17-
it('detects invalid coding style in bad.html and report as error', () => {
18-
waitsForPromise(() => {
19-
const bad = path.join(__dirname, 'fixtures', 'bad.html');
20-
return atom.workspace.open(bad).then(editor => lint(editor)).then((messages) => {
21-
expect(messages.length).toEqual(1);
16+
it('detects invalid coding style in bad.html and report as error', async () => {
17+
const bad = path.join(__dirname, 'fixtures', 'bad.html');
18+
const editor = await atom.workspace.open(bad);
19+
const messages = await lint(editor);
2220

23-
// test only the first error
24-
expect(messages[0].type).toBe('error');
25-
expect(messages[0].text).toBe('Doctype must be declared first.');
26-
expect(messages[0].filePath).toBe(bad);
27-
expect(messages[0].range).toEqual([[0, 0], [0, 5]]);
28-
});
29-
});
21+
expect(messages.length).toEqual(1);
22+
expect(messages[0].type).toBe('error');
23+
expect(messages[0].text).toBe('Doctype must be declared first.');
24+
expect(messages[0].filePath).toBe(bad);
25+
expect(messages[0].range).toEqual([[0, 0], [0, 5]]);
3026
});
3127

32-
it('finds nothing wrong with a valid file (good.html)', () => {
33-
waitsForPromise(() => {
34-
const good = path.join(__dirname, 'fixtures', 'good.html');
35-
return atom.workspace.open(good).then(editor => lint(editor)).then((messages) => {
36-
expect(messages.length).toBe(0);
37-
});
38-
});
28+
it('finds nothing wrong with a valid file (good.html)', async () => {
29+
const good = path.join(__dirname, 'fixtures', 'good.html');
30+
const editor = await atom.workspace.open(good);
31+
const messages = await lint(editor);
32+
33+
expect(messages.length).toBe(0);
3934
});
4035
});

0 commit comments

Comments
 (0)