|
| 1 | +const { describe, it } = require('node:test'); |
| 2 | +const assert = require('node:assert/strict'); |
1 | 3 | const path = require('path'); |
2 | | -const { expect } = require('chai'); |
3 | 4 |
|
4 | 5 | const { listFiles } = require('../src/listFiles.js'); |
5 | 6 |
|
6 | 7 | describe('listFiles', () => { |
7 | 8 | it('gives a list of files', async () => { |
8 | 9 | const files = await listFiles('*.svg', path.resolve(__dirname, './fixture/')); |
9 | | - expect(files.length).to.equal(2); |
10 | | - expect(files).to.have.members([ |
11 | | - path.join(__dirname, './fixture/a.svg'), |
12 | | - path.join(__dirname, './fixture/b.svg'), |
13 | | - ]); |
| 10 | + assert.equal(files.length, 2); |
| 11 | + assert.deepEqual( |
| 12 | + files.sort(), |
| 13 | + [path.join(__dirname, './fixture/a.svg'), path.join(__dirname, './fixture/b.svg')].sort(), |
| 14 | + ); |
14 | 15 | }); |
15 | 16 |
|
16 | 17 | it('only gives files and no folders', async () => { |
17 | 18 | const files = await listFiles('**/*.svg', path.resolve(__dirname, './fixture/')); |
18 | | - expect(files.length).to.equal(4); |
19 | | - expect(files).to.have.members([ |
20 | | - path.join(__dirname, './fixture/a.svg'), |
21 | | - path.join(__dirname, './fixture/b.svg'), |
22 | | - path.join(__dirname, './fixture/sub/sub-b.mark.svg'), |
23 | | - path.join(__dirname, './fixture/sub/sub-a.svg'), |
24 | | - ]); |
| 19 | + assert.equal(files.length, 4); |
| 20 | + assert.deepEqual( |
| 21 | + files.sort(), |
| 22 | + [ |
| 23 | + path.join(__dirname, './fixture/a.svg'), |
| 24 | + path.join(__dirname, './fixture/b.svg'), |
| 25 | + path.join(__dirname, './fixture/sub/sub-b.mark.svg'), |
| 26 | + path.join(__dirname, './fixture/sub/sub-a.svg'), |
| 27 | + ].sort(), |
| 28 | + ); |
25 | 29 | }); |
26 | 30 |
|
27 | 31 | it('will copy files inside dot folders', async () => { |
28 | 32 | const files = await listFiles('**/*.svg', path.resolve(__dirname, './fixtureDot/')); |
29 | | - expect(files.length).to.equal(1); |
30 | | - expect(files[0]).to.match(/fixtureDot(\/|\\)\.folder(\/|\\)inside-dot-folder\.svg$/); |
| 33 | + assert.equal(files.length, 1); |
| 34 | + assert.match(files[0], /fixtureDot(\/|\\)\.folder(\/|\\)inside-dot-folder\.svg$/); |
31 | 35 | }); |
32 | 36 | }); |
0 commit comments