import ScriptError from './ScriptError.vue'

const scriptError = `"Error: Webpack Compilation Error\n./cypress/integration/commands/actions/check_spec.js\nModule build failed (from /Users/username/work/cypress/node_modules/babel-loader/lib/index.js):\nSyntaxError: /Users/username/work/cypress/packages/driver/cypress/integration/commands/actions/check_spec.js: Unexpected token, expected \",\" (13:2)\n\n\u001b[0m \u001b[90m 11 |\u001b[39m   }\u001b[0m\n\u001b[0m \u001b[90m 12 |\u001b[39m\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 13 |\u001b[39m   beforeEach(\u001b[36mfunction\u001b[39m () {\u001b[0m\n\u001b[0m \u001b[90m    |\u001b[39m   \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 14 |\u001b[39m     \u001b[36mconst\u001b[39m doc \u001b[33m=\u001b[39m cy\u001b[33m.\u001b[39mstate(\u001b[32m'document'\u001b[39m)\u001b[0m\n\u001b[0m \u001b[90m 15 |\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 16 |\u001b[39m     $(doc\u001b[33m.\u001b[39mbody)\u001b[33m.\u001b[39mempty()\u001b[33m.\u001b[39mhtml(\u001b[36mthis\u001b[39m\u001b[33m.\u001b[39mbody)\u001b[0m\n    at Watching.handle [as handler] (/Users/username/work/cypress/npm/webpack-preprocessor/dist/index.js:180:23)\n    at /Users/username/work/cypress/node_modules/webpack/lib/Watching.js:99:9\n    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/username/work/cypress/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)\n    at AsyncSeriesHook.lazyCompileHook (/Users/username/work/cypress/node_modules/tapable/lib/Hook.js:154:20)\n    at Watching._done (/Users/username/work/cypress/node_modules/webpack/lib/Watching.js:98:28)\n    at /Users/username/work/cypress/node_modules/webpack/lib/Watching.js:73:19\n    at Compiler.emitRecords (/Users/username/work/cypress/node_modules/webpack/lib/Compiler.js:499:39)\n    at /Users/username/work/cypress/node_modules/webpack/lib/Watching.js:54:20\n    at /Users/username/work/cypress/node_modules/webpack/lib/Compiler.js:485:14\n    at eval (eval at create (/Users/username/work/cypress/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)\n    at /Users/username/work/cypress/node_modules/copy-webpack-plugin/dist/index.js:115:7\n    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/username/work/cypress/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:7:1)\n    at AsyncSeriesHook.lazyCompileHook (/Users/username/work/cypress/node_modules/tapable/lib/Hook.js:154:20)\n    at /Users/username/work/cypress/node_modules/webpack/lib/Compiler.js:482:27\n    at /Users/username/work/cypress/node_modules/neo-async/async.js:2818:7\n    at done (/Users/username/work/cypress/node_modules/neo-async/async.js:3522:9)\n    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/username/work/cypress/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)\n    at /Users/username/work/cypress/node_modules/webpack/lib/Compiler.js:464:33\n    at /Users/username/work/cypress/packages/server/node_modules/graceful-fs/graceful-fs.js:111:16\n    at /Users/username/work/cypress/packages/server/node_modules/graceful-fs/graceful-fs.js:111:16\n    at /Users/username/work/cypress/node_modules/graceful-fs/graceful-fs.js:61:14\n    at /Users/username/work/cypress/packages/server/node_modules/graceful-fs/graceful-fs.js:45:10\n    at FSReqCallback.oncomplete (node:fs:188:23)\n    at createDeferred (/Users/username/work/cypress/npm/webpack-preprocessor/dist/deferred.js:8:19)\n    at onCompile (/Users/username/work/cypress/npm/webpack-preprocessor/dist/index.js:213:60)\n    at SyncHook.eval (eval at create (/Users/username/work/cypress/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:9:1)\n    at SyncHook.lazyCompileHook (/Users/username/work/cypress/node_modules/tapable/lib/Hook.js:154:20)\n`

describe('ScriptError', () => {
  it('renders', () => {
    cy.mount(() => <ScriptError error={scriptError} />)

    cy.get('span').contains('beforeEach').should('be.visible')
    cy.percySnapshot()
  })
})
