diff --git a/detox/package.json b/detox/package.json index 52488997d4..c308e928f7 100644 --- a/detox/package.json +++ b/detox/package.json @@ -76,6 +76,7 @@ "src/utils/environment.js", "src/utils/logger.js", "src/utils/onTerminate.js", + "src/utils/pipeCommands.js", "src/utils/sleep.js", "AAPT.js", "ADB.js", diff --git a/detox/src/utils/__snapshots__/pipeCommands.test.js.snap b/detox/src/utils/__snapshots__/pipeCommands.test.js.snap deleted file mode 100644 index db7ee2e9e4..0000000000 --- a/detox/src/utils/__snapshots__/pipeCommands.test.js.snap +++ /dev/null @@ -1,25 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`pipeUtils escape in quoted regexp on *nix should escape [\\] 1`] = `"\\\\[kworker\\\\\\\\0:0\\\\]"`; - -exports[`pipeUtils escape in quoted regexp on *nix should escape ^*$ 1`] = `"\\\\^ma\\\\*tch\\\\$"`; - -exports[`pipeUtils escape in quoted regexp on *nix should escape dots 1`] = `"com\\\\.company\\\\.bundle"`; - -exports[`pipeUtils escape in quoted regexp on *nix should escape double quotes with slash 1`] = `"\\\\\\"a"`; - -exports[`pipeUtils escape in quoted regexp on *nix should not escape non-special characters 1`] = `"bundle_name"`; - -exports[`pipeUtils escape in quoted regexp on win32 should escape only double quotes 1`] = `"^Hello\\\\s \\"\\".*\\"\\"$"`; - -exports[`pipeUtils escape in quoted string on *nix should escape double quotes with slash 1`] = `"Says \\\\\\"Hello\\\\\\""`; - -exports[`pipeUtils escape in quoted string on win32 should escape double quotes with double quotes 1`] = `"Says \\"\\"Hello\\"\\""`; - -exports[`pipeUtils search by fragment pipe command on *nix should use grep -e "fragment" 1`] = `"grep -e \\"^Hello\\\\s \\\\\\".*\\\\\\"$\\""`; - -exports[`pipeUtils search by fragment pipe command on win32 should use findstr /C:"fragment" 1`] = `"findstr /C:\\"^Hello\\\\s \\"\\".*\\"\\"$\\""`; - -exports[`pipeUtils search by regexp pipe command on *nix should use grep "regexp" 1`] = `"grep \\"^Hello\\\\s \\\\\\".*\\\\\\"$\\""`; - -exports[`pipeUtils search by regexp pipe command on win32 should use findstr /R /C:"regexp" 1`] = `"findstr /R /C:\\"^Hello\\\\s \\"\\".*\\"\\"$\\""`; diff --git a/detox/src/utils/pipeCommands.test.js b/detox/src/utils/pipeCommands.test.js deleted file mode 100644 index a2bf31cc4d..0000000000 --- a/detox/src/utils/pipeCommands.test.js +++ /dev/null @@ -1,86 +0,0 @@ -const pipeCommands = require('./pipeCommands'); - -const _win32 = pipeCommands._win32(); -const _nix = pipeCommands._nix(); - -describe('pipeUtils', () => { - describe('escape in quoted string', () => { - describe('on win32', () => { - const escape = _win32.escape.inQuotedString; - - it('should escape double quotes with double quotes', () => - expect(escape('Says "Hello"')).toMatchSnapshot()); - }); - - describe('on *nix', () => { - const escape = _nix.escape.inQuotedString; - - it('should escape double quotes with slash', () => - expect(escape('Says "Hello"')).toMatchSnapshot()); - }); - }); - - describe('escape in quoted regexp', () => { - describe('on win32', () => { - const escape = _win32.escape.inQuotedRegexp; - - it('should escape only double quotes', () => - expect(escape('^Hello\\s ".*"$')).toMatchSnapshot()); - }); - - describe('on *nix', () => { - const escape = _nix.escape.inQuotedRegexp; - - it('should not escape non-special characters', () => - expect(escape('bundle_name')).toMatchSnapshot()); - - it('should escape double quotes with slash', () => - expect(escape('"a')).toMatchSnapshot()); - - it('should escape [\\]', () => - expect(escape('[kworker\\0:0]')).toMatchSnapshot()); - - it('should escape ^*$', () => - expect(escape('^ma*tch$')).toMatchSnapshot()); - - it('should escape dots', () => - expect(escape('com.company.bundle')).toMatchSnapshot()); - }); - }); - - describe('search by regexp pipe command', () => { - const regexp = '^Hello\\s ".*"$'; - - describe('on win32', () => { - const search = _win32.search.regexp; - - it('should use findstr /R /C:"regexp"', () => - expect(search(regexp)).toMatchSnapshot()); - }); - - describe('on *nix', () => { - const search = _nix.search.regexp; - - it('should use grep "regexp"', () => - expect(search(regexp)).toMatchSnapshot()); - }); - }); - - describe('search by fragment pipe command', () => { - const fragment = '^Hello\\s ".*"$'; - - describe('on win32', () => { - const search = _win32.search.fragment; - - it('should use findstr /C:"fragment"', () => - expect(search(fragment)).toMatchSnapshot()); - }); - - describe('on *nix', () => { - const search = _nix.search.fragment; - - it('should use grep -e "fragment"', () => - expect(search(fragment)).toMatchSnapshot()); - }); - }); -});