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

Commit c652974

Browse files
test: possible fix for config spec race conditions
1 parent e85a28f commit c652974

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

spec/config-spec.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as fs from 'fs';
55
import rimraf from 'rimraf';
66
import {
77
copyFileToTempDir,
8-
openAndSetProjectDir
8+
openAndSetProjectDir,
9+
wait
910
} from './helpers';
1011

1112
import Config from '../lib/config';
@@ -20,7 +21,7 @@ const paths = {
2021

2122

2223
// Skipping until we can sort out why these are so flaky in CI.
23-
xdescribe('Config module', () => {
24+
describe('Config module', () => {
2425

2526
beforeEach(async () => {
2627
atom.config.set('linter-eslint-node.foo', '');
@@ -118,7 +119,8 @@ xdescribe('Config module', () => {
118119
it('reacts to changes made to .linter-eslint', async () => {
119120
editor.setText(JSON.stringify({ foo: 'zort' }));
120121
await editor.save();
121-
Config.update();
122+
await wait(1000);
123+
122124
expect(Config.get('foo')).toBe('zort');
123125
});
124126

@@ -127,20 +129,20 @@ xdescribe('Config module', () => {
127129
let disposable = Config.onConfigDidChange(handler.call);
128130
editor.setText(JSON.stringify({ foo: 'wat' }));
129131
await editor.save();
132+
await wait(1000);
133+
130134
expect(handler.called()).toBe(true);
131-
let [config, prevConfig] = handler.calledWith[0];
135+
let [config, prevConfig] = handler.calledWith[0] || [];
132136
expect(config.foo).toBe('wat');
133137
expect(prevConfig.foo).toBe('thud');
134138
disposable.dispose();
135139
});
136140

137-
// Skipping test because it relies too much on precise timing of moving
138-
// parts; passes locally but tends to fail on CI.
139-
// TODO: See about rewriting this.
140-
xit('stops treating .linter-eslint as an overrides file if we rename it', async () => {
141+
it('stops treating .linter-eslint as an overrides file if we rename it', async () => {
141142
expect(Config.get('foo')).toBe('thud');
142143
fs.renameSync(tempPath, `${tempDir}${path.sep}_linter-eslint`);
143-
Config.rescan();
144+
await wait(1000);
145+
144146
expect(Config.get('foo')).toBe('');
145147
});
146148

0 commit comments

Comments
 (0)