flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
28
BACK_BACK/node_modules/@parcel/watcher/test/watched.js
generated
vendored
Executable file
28
BACK_BACK/node_modules/@parcel/watcher/test/watched.js
generated
vendored
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
const Watcher = require('../index');
|
||||
const fs = require('@parcel/fs');
|
||||
const path = require('path');
|
||||
const assert = require('assert');
|
||||
|
||||
describe('watched paths', function() {
|
||||
let tmpFolder = path.join(__dirname, './tmp/');
|
||||
|
||||
before(() => {
|
||||
fs.mkdirp(tmpFolder);
|
||||
});
|
||||
|
||||
it('Should return watched paths', async () => {
|
||||
let watcher = new Watcher({});
|
||||
|
||||
let filepath = path.join(tmpFolder, 'file1.txt');
|
||||
await fs.writeFile(filepath, 'this is a text document');
|
||||
|
||||
watcher.add(filepath);
|
||||
|
||||
assert(
|
||||
Object.keys(watcher.getWatched())[0] === filepath,
|
||||
'getWatched should return all the watched paths.'
|
||||
);
|
||||
|
||||
await watcher.stop();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue