|
1 | 1 | 'use babel';
|
2 | 2 |
|
3 | 3 | import * as path from 'path';
|
| 4 | +// eslint-disable-next-line no-unused-vars |
| 5 | +import { it, fit, wait, beforeEach, afterEach } from 'jasmine-fix'; |
4 | 6 |
|
5 | 7 | const { lint } = require('../lib/index.js').provideLinter();
|
6 | 8 |
|
7 | 9 | describe('The htmlhint provider for Linter', () => {
|
8 |
| - beforeEach(() => { |
| 10 | + beforeEach(async () => { |
9 | 11 | 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'); |
15 | 14 | });
|
16 | 15 |
|
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); |
22 | 20 |
|
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]]); |
30 | 26 | });
|
31 | 27 |
|
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); |
39 | 34 | });
|
40 | 35 | });
|
0 commit comments