diff --git a/.gitignore b/.gitignore index 953a7f6a..a3598100 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ npm-debug.log* /local /reports /node_modules -/test/helpers/\[special\?directory\] +/test/fixtures/\[special\?directory\] .DS_Store Thumbs.db diff --git a/globalSetup.js b/globalSetup.js index f28c4be3..cf42b7ce 100644 --- a/globalSetup.js +++ b/globalSetup.js @@ -4,9 +4,9 @@ const fs = require('fs'); // eslint-disable-next-line import/no-extraneous-dependencies const mkdirp = require('mkdirp'); -const removeIllegalCharacterForWindows = require('./test/utils/removeIllegalCharacterForWindows'); +const removeIllegalCharacterForWindows = require('./test/helpers/removeIllegalCharacterForWindows'); -const baseDir = path.resolve(__dirname, 'test/helpers'); +const baseDir = path.resolve(__dirname, 'test/fixtures'); const specialFiles = { '[special?directory]/nested/nestedfile.txt': '', diff --git a/test/CopyPlugin.test.js b/test/CopyPlugin.test.js index 5f25b63e..8405a89e 100644 --- a/test/CopyPlugin.test.js +++ b/test/CopyPlugin.test.js @@ -1,10 +1,10 @@ import path from 'path'; -import { MockCompiler } from './utils/mocks'; -import { run, runEmit, runChange } from './utils/run'; +import { MockCompiler } from './helpers/mocks'; +import { run, runEmit, runChange } from './helpers/run'; const BUILD_DIR = path.join(__dirname, 'build'); -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('apply function', () => { describe('basic', () => { @@ -393,7 +393,7 @@ describe('apply function', () => { ], }) .then((compilation) => { - const absFrom = path.join(HELPER_DIR, 'file.txt'); + const absFrom = path.join(FIXTURES_DIR, 'file.txt'); expect(Array.from(compilation.fileDependencies).sort()).toEqual( [absFrom].sort() @@ -412,7 +412,7 @@ describe('apply function', () => { ], }) .then((compilation) => { - const absFrom = path.join(HELPER_DIR, 'directory'); + const absFrom = path.join(FIXTURES_DIR, 'directory'); expect(Array.from(compilation.contextDependencies).sort()).toEqual( [absFrom].sort() @@ -435,7 +435,7 @@ describe('apply function', () => { Array.from(compilation.contextDependencies) .map((contextDependency) => contextDependency) .sort() - ).toEqual([path.join(HELPER_DIR, 'directory')].sort()); + ).toEqual([path.join(FIXTURES_DIR, 'directory')].sort()); }) .then(done) .catch(done); @@ -452,7 +452,7 @@ describe('apply function', () => { ], }) .then((compilation) => { - const absFrom = path.join(HELPER_DIR, 'directory'); + const absFrom = path.join(FIXTURES_DIR, 'directory'); expect(compilation.contextDependencies).not.toContain(absFrom); }) @@ -463,8 +463,8 @@ describe('apply function', () => { it('only include files that have changed', (done) => { runChange({ expectedAssetKeys: ['tempfile1.txt'], - newFileLoc1: path.join(HELPER_DIR, 'watch', 'tempfile1.txt'), - newFileLoc2: path.join(HELPER_DIR, 'watch', 'tempfile2.txt'), + newFileLoc1: path.join(FIXTURES_DIR, 'watch', 'tempfile1.txt'), + newFileLoc2: path.join(FIXTURES_DIR, 'watch', 'tempfile2.txt'), patterns: [ { from: 'tempfile1.txt', @@ -482,13 +482,13 @@ describe('apply function', () => { runChange({ expectedAssetKeys: ['tempfile1.txt'], newFileLoc1: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile1.txt' ), newFileLoc2: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile2.txt' @@ -507,13 +507,13 @@ describe('apply function', () => { runChange({ expectedAssetKeys: ['tempfile1.txt', 'tempfile2.txt', '.gitkeep'], newFileLoc1: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile1.txt' ), newFileLoc2: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile2.txt' @@ -535,13 +535,13 @@ describe('apply function', () => { runChange({ expectedAssetKeys: ['dest1/tempfile1.txt'], newFileLoc1: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile1.txt' ), newFileLoc2: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile2.txt' @@ -562,13 +562,13 @@ describe('apply function', () => { runChange({ expectedAssetKeys: ['dest1/tempfile1.txt', 'dest2/tempfile1.txt'], newFileLoc1: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile1.txt' ), newFileLoc2: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile2.txt' @@ -597,12 +597,12 @@ describe('apply function', () => { 'dest2/directory/tempfile1.txt', ], newFileLoc1: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile1.txt' ), - newFileLoc2: path.join(HELPER_DIR, 'watch', 'tempfile2.txt'), + newFileLoc2: path.join(FIXTURES_DIR, 'watch', 'tempfile2.txt'), patterns: [ { context: 'directory', @@ -626,12 +626,12 @@ describe('apply function', () => { 'dest2/tempfile1.txt', ], newFileLoc1: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile1.txt' ), - newFileLoc2: path.join(HELPER_DIR, 'watch', 'tempfile2.txt'), + newFileLoc2: path.join(FIXTURES_DIR, 'watch', 'tempfile2.txt'), patterns: [ { from: '**/*.txt', @@ -651,9 +651,9 @@ describe('apply function', () => { it('copy only changed files (multiple patterns with difference context 2)', (done) => { runChange({ expectedAssetKeys: ['dest1/tempfile1.txt'], - newFileLoc1: path.join(HELPER_DIR, 'watch', 'tempfile1.txt'), + newFileLoc1: path.join(FIXTURES_DIR, 'watch', 'tempfile1.txt'), newFileLoc2: path.join( - HELPER_DIR, + FIXTURES_DIR, 'watch', 'directory', 'tempfile2.txt' diff --git a/test/cache-option.test.js b/test/cache-option.test.js index f175961a..d2f4b415 100644 --- a/test/cache-option.test.js +++ b/test/cache-option.test.js @@ -6,9 +6,9 @@ import cacache from 'cacache'; import findCacheDir from 'find-cache-dir'; import isGzip from 'is-gzip'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('cache option', () => { const cacheDir = findCacheDir({ name: 'copy-webpack-plugin' }); @@ -184,7 +184,7 @@ describe('cache option', () => { it('should cache binary file', (done) => { const from = 'file.txt.gz'; - const content = fs.readFileSync(path.join(HELPER_DIR, from)); + const content = fs.readFileSync(path.join(FIXTURES_DIR, from)); const expectedNewContent = zlib.gzipSync('newchanged!'); expect(isGzip(content)).toBe(true); diff --git a/test/context-option.test.js b/test/context-option.test.js index a42eaf92..f7069bc8 100644 --- a/test/context-option.test.js +++ b/test/context-option.test.js @@ -1,8 +1,8 @@ import path from 'path'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('context option', () => { it('should work when "from" is a file', (done) => { @@ -74,7 +74,7 @@ describe('context option', () => { ], patterns: [ { - // Todo strange behavour when you use `HELPER_DIR`, need investigate for next major release + // Todo strange behavour when you use `FIXTURES_DIR`, need investigate for next major release from: '.', context: '[special?directory]', }, @@ -129,7 +129,7 @@ describe('context option', () => { ], patterns: [ { - context: path.join(HELPER_DIR, 'directory'), + context: path.join(FIXTURES_DIR, 'directory'), from: '**/*', to: 'nested', }, @@ -177,7 +177,7 @@ describe('context option', () => { patterns: [ { from: 'directoryfile.txt', - context: path.join(HELPER_DIR, 'directory'), + context: path.join(FIXTURES_DIR, 'directory'), }, ], }) @@ -192,7 +192,7 @@ describe('context option', () => { 'newdirectory/nestedfile.txt', ], options: { - context: path.join(HELPER_DIR, 'directory'), + context: path.join(FIXTURES_DIR, 'directory'), }, patterns: [ { @@ -254,7 +254,7 @@ describe('context option', () => { 'newdirectory/nesteddir/nestedfile.txt', ], options: { - context: path.join(HELPER_DIR, 'dir (86)'), + context: path.join(FIXTURES_DIR, 'dir (86)'), }, patterns: [ { diff --git a/test/helpers/.file.txt b/test/fixtures/.file.txt similarity index 100% rename from test/helpers/.file.txt rename to test/fixtures/.file.txt diff --git a/test/helpers/[!]/hello.txt b/test/fixtures/[!]/hello.txt similarity index 100% rename from test/helpers/[!]/hello.txt rename to test/fixtures/[!]/hello.txt diff --git a/test/helpers/binextension.bin b/test/fixtures/binextension.bin similarity index 100% rename from test/helpers/binextension.bin rename to test/fixtures/binextension.bin diff --git a/test/helpers/dir (86)/file.txt b/test/fixtures/dir (86)/file.txt similarity index 100% rename from test/helpers/dir (86)/file.txt rename to test/fixtures/dir (86)/file.txt diff --git a/test/helpers/dir (86)/nesteddir/deepnesteddir/deepnesteddir.txt b/test/fixtures/dir (86)/nesteddir/deepnesteddir/deepnesteddir.txt similarity index 100% rename from test/helpers/dir (86)/nesteddir/deepnesteddir/deepnesteddir.txt rename to test/fixtures/dir (86)/nesteddir/deepnesteddir/deepnesteddir.txt diff --git a/test/helpers/dir (86)/nesteddir/nestedfile.txt b/test/fixtures/dir (86)/nesteddir/nestedfile.txt similarity index 100% rename from test/helpers/dir (86)/nesteddir/nestedfile.txt rename to test/fixtures/dir (86)/nesteddir/nestedfile.txt diff --git a/test/helpers/directory/.dottedfile b/test/fixtures/directory/.dottedfile similarity index 100% rename from test/helpers/directory/.dottedfile rename to test/fixtures/directory/.dottedfile diff --git a/test/helpers/directory/directoryfile.txt b/test/fixtures/directory/directoryfile.txt similarity index 100% rename from test/helpers/directory/directoryfile.txt rename to test/fixtures/directory/directoryfile.txt diff --git a/test/helpers/directory/nested/deep-nested/deepnested.txt b/test/fixtures/directory/nested/deep-nested/deepnested.txt similarity index 100% rename from test/helpers/directory/nested/deep-nested/deepnested.txt rename to test/fixtures/directory/nested/deep-nested/deepnested.txt diff --git a/test/helpers/directory/nested/nestedfile.txt b/test/fixtures/directory/nested/nestedfile.txt similarity index 100% rename from test/helpers/directory/nested/nestedfile.txt rename to test/fixtures/directory/nested/nestedfile.txt diff --git a/test/helpers/file.txt b/test/fixtures/file.txt similarity index 100% rename from test/helpers/file.txt rename to test/fixtures/file.txt diff --git a/test/helpers/file.txt.gz b/test/fixtures/file.txt.gz similarity index 100% rename from test/helpers/file.txt.gz rename to test/fixtures/file.txt.gz diff --git a/test/helpers/noextension b/test/fixtures/noextension similarity index 100% rename from test/helpers/noextension rename to test/fixtures/noextension diff --git a/test/helpers/symlink/directory-ln b/test/fixtures/symlink/directory-ln similarity index 100% rename from test/helpers/symlink/directory-ln rename to test/fixtures/symlink/directory-ln diff --git a/test/helpers/symlink/directory/file.txt b/test/fixtures/symlink/directory/file.txt similarity index 100% rename from test/helpers/symlink/directory/file.txt rename to test/fixtures/symlink/directory/file.txt diff --git a/test/helpers/symlink/directory/nested-directory/file-in-nested-directory.txt b/test/fixtures/symlink/directory/nested-directory/file-in-nested-directory.txt similarity index 100% rename from test/helpers/symlink/directory/nested-directory/file-in-nested-directory.txt rename to test/fixtures/symlink/directory/nested-directory/file-in-nested-directory.txt diff --git a/test/helpers/symlink/file-ln.txt b/test/fixtures/symlink/file-ln.txt similarity index 100% rename from test/helpers/symlink/file-ln.txt rename to test/fixtures/symlink/file-ln.txt diff --git a/test/helpers/symlink/file.txt b/test/fixtures/symlink/file.txt similarity index 100% rename from test/helpers/symlink/file.txt rename to test/fixtures/symlink/file.txt diff --git a/test/helpers/watch/.gitkeep b/test/fixtures/watch/.gitkeep similarity index 100% rename from test/helpers/watch/.gitkeep rename to test/fixtures/watch/.gitkeep diff --git a/test/helpers/watch/directory/.gitkeep b/test/fixtures/watch/directory/.gitkeep similarity index 100% rename from test/helpers/watch/directory/.gitkeep rename to test/fixtures/watch/directory/.gitkeep diff --git a/test/flatten-option.test.js b/test/flatten-option.test.js index 80766edb..ef83f46c 100644 --- a/test/flatten-option.test.js +++ b/test/flatten-option.test.js @@ -1,4 +1,4 @@ -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; describe('flatten option', () => { it('should flatten a directory\'s files to a root directory when "from" is a file', (done) => { diff --git a/test/force-option.test.js b/test/force-option.test.js index 1567007d..decff7d5 100644 --- a/test/force-option.test.js +++ b/test/force-option.test.js @@ -1,4 +1,4 @@ -import { runForce } from './utils/run'; +import { runForce } from './helpers/run'; describe('force option', () => { describe('is not specified', () => { diff --git a/test/from-option.test.js b/test/from-option.test.js index 804ab42d..1da1e30f 100644 --- a/test/from-option.test.js +++ b/test/from-option.test.js @@ -1,8 +1,8 @@ import path from 'path'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('from option', () => { describe('is a file', () => { @@ -24,7 +24,7 @@ describe('from option', () => { expectedAssetKeys: ['file.txt'], patterns: [ { - from: path.join(HELPER_DIR, 'file.txt'), + from: path.join(FIXTURES_DIR, 'file.txt'), }, ], }) @@ -50,7 +50,7 @@ describe('from option', () => { expectedAssetKeys: ['directoryfile.txt'], patterns: [ { - from: path.join(HELPER_DIR, 'directory/directoryfile.txt'), + from: path.join(FIXTURES_DIR, 'directory/directoryfile.txt'), }, ], }) @@ -77,7 +77,7 @@ describe('from option', () => { expectedAssetKeys: [], expectedWarnings: [ new Error( - `unable to locate 'nonexistent.txt' at '${HELPER_DIR}${path.sep}nonexistent.txt'` + `unable to locate 'nonexistent.txt' at '${FIXTURES_DIR}${path.sep}nonexistent.txt'` ), ], patterns: [ @@ -162,7 +162,7 @@ describe('from option', () => { ], patterns: [ { - from: '../helpers', + from: '../fixtures', }, ], }) @@ -216,7 +216,7 @@ describe('from option', () => { ], patterns: [ { - from: path.join(HELPER_DIR, 'directory'), + from: path.join(FIXTURES_DIR, 'directory'), }, ], }) @@ -260,7 +260,7 @@ describe('from option', () => { expectedAssetKeys: ['deep-nested/deepnested.txt', 'nestedfile.txt'], patterns: [ { - from: path.join(HELPER_DIR, 'directory/nested'), + from: path.join(FIXTURES_DIR, 'directory/nested'), }, ], }) @@ -273,7 +273,7 @@ describe('from option', () => { expectedAssetKeys: [], expectedWarnings: [ new Error( - `unable to locate 'nonexistent' at '${HELPER_DIR}${path.sep}nonexistent'` + `unable to locate 'nonexistent' at '${FIXTURES_DIR}${path.sep}nonexistent'` ), ], patterns: [ @@ -306,7 +306,7 @@ describe('from option', () => { expectedAssetKeys: ['file.txt'], patterns: [ { - from: path.join(HELPER_DIR, '*.txt'), + from: path.join(FIXTURES_DIR, '*.txt'), }, ], }) @@ -359,7 +359,7 @@ describe('from option', () => { ], patterns: [ { - from: path.join(HELPER_DIR, '**/*.txt'), + from: path.join(FIXTURES_DIR, '**/*.txt'), }, ], }) diff --git a/test/globOptions-option.test.js b/test/globOptions-option.test.js index a6dc0a38..2198b262 100644 --- a/test/globOptions-option.test.js +++ b/test/globOptions-option.test.js @@ -1,4 +1,4 @@ -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; describe('from option', () => { it('should move files exclude dot files', (done) => { diff --git a/test/utils/mocks.js b/test/helpers/mocks.js similarity index 93% rename from test/utils/mocks.js rename to test/helpers/mocks.js index 358d2e53..cc9eb460 100644 --- a/test/utils/mocks.js +++ b/test/helpers/mocks.js @@ -4,12 +4,12 @@ import CachedInputFileSystem from 'enhanced-resolve/lib/CachedInputFileSystem'; import NodeJsInputFileSystem from 'enhanced-resolve/lib/NodeJsInputFileSystem'; const BUILD_DIR = path.join(__dirname, '../build'); -const HELPER_DIR = path.join(__dirname, '../helpers'); +const FIXTURES_DIR = path.join(__dirname, '../fixtures'); class MockCompiler { constructor(options = {}) { this.options = { - context: HELPER_DIR, + context: FIXTURES_DIR, output: { path: options.outputPath || BUILD_DIR, }, diff --git a/test/utils/removeIllegalCharacterForWindows.js b/test/helpers/removeIllegalCharacterForWindows.js similarity index 100% rename from test/utils/removeIllegalCharacterForWindows.js rename to test/helpers/removeIllegalCharacterForWindows.js diff --git a/test/utils/run.js b/test/helpers/run.js similarity index 100% rename from test/utils/run.js rename to test/helpers/run.js diff --git a/test/ignore-option.test.js b/test/ignore-option.test.js index 50db76c8..f65d2cb9 100644 --- a/test/ignore-option.test.js +++ b/test/ignore-option.test.js @@ -1,4 +1,4 @@ -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; describe('ignore option', () => { it('should ignore files when "from" is a file', (done) => { diff --git a/test/test-option.test.js b/test/test-option.test.js index c0503161..e32b95db 100644 --- a/test/test-option.test.js +++ b/test/test-option.test.js @@ -1,6 +1,6 @@ import path from 'path'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; describe('test option', () => { it('should move files to a root directory with [1]', (done) => { diff --git a/test/to-option.test.js b/test/to-option.test.js index d42398af..aed136d5 100644 --- a/test/to-option.test.js +++ b/test/to-option.test.js @@ -1,10 +1,10 @@ import path from 'path'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; const BUILD_DIR = path.join(__dirname, 'build'); const TEMP_DIR = path.join(__dirname, 'tempdir'); -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('to option', () => { describe('is a file', () => { @@ -197,7 +197,7 @@ describe('to option', () => { expectedAssetKeys: ['newdirectory/directoryfile.txt'], patterns: [ { - from: path.join(HELPER_DIR, 'directory', 'directoryfile.txt'), + from: path.join(FIXTURES_DIR, 'directory', 'directoryfile.txt'), to: 'newdirectory', }, ], @@ -211,7 +211,7 @@ describe('to option', () => { expectedAssetKeys: ['newdirectory/directoryfile.txt'], patterns: [ { - from: path.join(HELPER_DIR, 'directory', 'directoryfile.txt'), + from: path.join(FIXTURES_DIR, 'directory', 'directoryfile.txt'), to: 'newdirectory/', }, ], @@ -247,7 +247,7 @@ describe('to option', () => { ], patterns: [ { - from: path.join(HELPER_DIR, 'directory', 'nested'), + from: path.join(FIXTURES_DIR, 'directory', 'nested'), to: 'newdirectory', }, ], diff --git a/test/toType-option.test.js b/test/toType-option.test.js index d6490f54..1ff4da9f 100644 --- a/test/toType-option.test.js +++ b/test/toType-option.test.js @@ -1,9 +1,9 @@ import path from 'path'; -import { runEmit } from './utils/run'; -import { MockCompilerNoStat } from './utils/mocks'; +import { runEmit } from './helpers/run'; +import { MockCompilerNoStat } from './helpers/mocks'; -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('toType option', () => { it('should move a file to a new file', (done) => { @@ -90,7 +90,7 @@ describe('toType option', () => { expectedAssetKeys: [], expectedWarnings: [ new Error( - `unable to locate 'nonexistent.txt' at '${HELPER_DIR}${path.sep}nonexistent.txt'` + `unable to locate 'nonexistent.txt' at '${FIXTURES_DIR}${path.sep}nonexistent.txt'` ), ], patterns: [ diff --git a/test/transform-option.test.js b/test/transform-option.test.js index a118d9cd..ce47a9d9 100644 --- a/test/transform-option.test.js +++ b/test/transform-option.test.js @@ -1,8 +1,8 @@ import path from 'path'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('transform option', () => { it('should transform file when "from" is a file', (done) => { @@ -15,7 +15,7 @@ describe('transform option', () => { { from: 'file.txt', transform(content, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); return `${content}changed`; }, @@ -44,7 +44,7 @@ describe('transform option', () => { { from: 'directory', transform(content, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); return `${content}changed`; }, @@ -71,7 +71,7 @@ describe('transform option', () => { { from: 'directory/**/*', transform(content, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); return `${content}changed`; }, diff --git a/test/transformPath-option.test.js b/test/transformPath-option.test.js index d48c6f22..af74cb74 100644 --- a/test/transformPath-option.test.js +++ b/test/transformPath-option.test.js @@ -1,8 +1,8 @@ import path from 'path'; -import { runEmit } from './utils/run'; +import { runEmit } from './helpers/run'; -const HELPER_DIR = path.join(__dirname, 'helpers'); +const FIXTURES_DIR = path.join(__dirname, 'fixtures'); describe('transformPath option', () => { it('should transform target path when "from" is a file', (done) => { @@ -12,7 +12,7 @@ describe('transformPath option', () => { { from: 'file.txt', transformPath(targetPath, absoluteFrom) { - expect(absoluteFrom).toBe(path.join(HELPER_DIR, 'file.txt')); + expect(absoluteFrom).toBe(path.join(FIXTURES_DIR, 'file.txt')); return targetPath.replace('file.txt', 'subdir/test.txt'); }, @@ -36,7 +36,7 @@ describe('transformPath option', () => { from: 'directory', transformPath(targetPath, absoluteFrom) { expect( - absoluteFrom.includes(path.join(HELPER_DIR, 'directory')) + absoluteFrom.includes(path.join(FIXTURES_DIR, 'directory')) ).toBe(true); return `/some/path/${path.basename(targetPath)}`; @@ -59,7 +59,7 @@ describe('transformPath option', () => { { from: 'directory/**/*', transformPath(targetPath, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); return `/some/path/${path.basename(targetPath)}.tst`; }, @@ -77,7 +77,7 @@ describe('transformPath option', () => { { from: 'file.txt', transformPath(targetPath, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); return new Promise((resolve) => { resolve(`/some/path/${path.basename(targetPath)}`); @@ -97,7 +97,7 @@ describe('transformPath option', () => { { from: 'file.txt', async transformPath(targetPath, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); const newPath = await new Promise((resolve) => { resolve(`/some/path/${path.basename(targetPath)}`); @@ -179,7 +179,7 @@ describe('transformPath option', () => { from: 'directory/**/*', to: 'nested/[path][name]-[hash:6].[ext]', transformPath(targetPath, absoluteFrom) { - expect(absoluteFrom.includes(HELPER_DIR)).toBe(true); + expect(absoluteFrom.includes(FIXTURES_DIR)).toBe(true); return targetPath.replace( `nested${path.sep}`,