nwb icon indicating copy to clipboard operation
nwb copied to clipboard

test failures with object.getprototypeof 1.0.1

Open jonenst opened this issue 2 years ago • 0 comments

This issue is a:

  • Bug report: test failures. The author of object.getprototypeof was kind enough to publish a workaround, so projects work again. But they have been broken for 4 months until today as far as I can tell (date of publish of is-equal 1.6.2, using object.getprototypeof). See https://github.com/inspect-js/is-equal/issues/77 for some insights.

REPRO

$ nwb new react-app tuu
# edit package.json to use object.getprototypeof 1.0.1
$ npm run test
> [email protected] test /tmp/bar/tuu
> nwb test-react
START:
08 09 2021 17:36:46.891:INFO [karma-server]: Karma v5.0.9 server started at http://0.0.0.0:9876/
08 09 2021 17:36:46.892:INFO [launcher]: Launching browsers PhantomJS with concurrency unlimited
08 09 2021 17:36:46.916:INFO [launcher]: Starting browser PhantomJS
08 09 2021 17:36:47.127:INFO [PhantomJS 2.1.1 (Linux x86_64)]: Connected on socket GChCaIIaxtzq9rV4AAAA with id 41645376
PhantomJS 2.1.1 (Linux x86_64) ERROR
  TypeError: Object is not a function (evaluating 'getPolyfill()')
  at webpack:///usr/local/lib/node_modules/nwb/node_modules/reflect.getprototypeof/index.js:10:1 <- tests/App.test.js:6830:33

Finished in 0.218 secs / 0 secs @ 17:36:47 GMT+0200 (heure d’été d’Europe centrale)

SUMMARY:
✔ 0 tests completed
Karma exit code was 1

Is the version of nwb you're using installed globally or locally? globally Which versions of Node.js, npm and nwb are you using (if using it globally)?

$ node -v
v10.19.0
$ npm -v
6.14.4
$ nwb -v
v0.25.2

Which modules are installed in your project? none

Try setting the DEBUG environment variable to nwb before running to check what generated configuration looks like:

# *nix
export DEBUG=nwb
> nwb test-react

  nwb 0 nwb-* dependencies in package.json +0ms
  nwb imported config module from /tmp/bar/tuu/nwb.config.js +2ms
  nwb user config: { type: 'react-app',
  babel: {},
  devServer: {},
  karma: {},
  npm: {},
  webpack: {} } +2ms
  nwb createWebpackConfig buildConfig: { babel: { presets: [ 'react' ] },
  devtool: 'cheap-module-inline-source-map',
  node: { fs: 'empty' },
  plugins: { status: { quiet: true } },
  resolve:
   { alias:
      { expect: '/tmp/bar/tuu/node_modules/expect',
        src: '/tmp/bar/tuu/src' } },
  server: { hot: false } } +19ms
  nwb karma config: { browsers: [ 'PhantomJS' ],
  coverageReporter:
   { dir: '/tmp/bar/tuu/coverage',
     reporters:
      [ { type: 'html', subdir: 'html' },
        { type: 'lcovonly', subdir: '.' },
        { type: 'text-summary' } ] },
  files:
   [ '/tmp/bar/tuu/node_modules/@babel/polyfill/dist/polyfill.js',
     '+(src|test?(s))/**/*+(.spec|.test).js' ],
  frameworks: [ 'mocha' ],
  mochaReporter: { showDiff: true },
  plugins:
   [ { 'preprocessor:sourcemap':
        [ 'factory',
          { [Function: createSourceMapLocatorPreprocessor] '$inject': [ 'args', 'logger' ] } ] },
     { webpackPlugin: [ 'type', [Function: Plugin] ],
       'preprocessor:webpack': [ 'factory', [Function: createPreprocesor] ],
       'middleware:webpackBlocker': [ 'factory', [Function: createWebpackBlocker] ] },
     { 'framework:mocha':
        [ 'factory',
          { [Function: initMocha] '$inject': [ 'config.files', 'config' ] } ] },
     { 'reporter:mocha':
        [ 'type',
          { [Function: MochaReporter]
            '$inject': [ 'baseReporterDecorator', 'formatError', 'config' ] } ] },
     { 'launcher:PhantomJS':
        [ 'type',
          { [Function: PhantomJSBrowser]
            '$inject':
             [ 'baseBrowserDecorator',
               'config.phantomjsLauncher',
               'args',
               'logger' ] } ] } ],
  preprocessors:
   { '+(src|test?(s))/**/*+(.spec|.test).js': [ 'webpack', 'sourcemap' ] },
  reporters: [ 'mocha' ],
  singleRun: true,
  webpack:
   { mode: 'development',
     module:
      { rules:
         [ { test: /\.js$/,
             loader: '/tmp/bar/tuu/node_modules/babel-loader/lib/index.js',
             exclude: /node_modules[\\\/](?!react-app-polyfill)/,
             options:
              { babelrc: false,
                cacheDirectory: true,
                presets:
                 [ [ '/tmp/bar/tuu/node_modules/@babel/preset-env/lib/index.js',
                     { loose: true, modules: false } ],
                   [ '/tmp/bar/tuu/node_modules/@babel/preset-react/lib/index.js',
                     { development: true } ],
                   [ '/tmp/bar/tuu/node_modules/babel-preset-proposals/lib/index.js',
                     { loose: true,
                       decorators: true,
                       classProperties: true,
                       exportDefaultFrom: true,
                       exportNamespaceFrom: true,
                       absolutePaths: true } ] ],
                plugins:
                 [ '/tmp/bar/tuu/node_modules/@babel/plugin-proposal-optional-chaining/lib/index.js',
                   '/tmp/bar/tuu/node_modules/@babel/plugin-proposal-nullish-coalescing-operator/lib/index.js',
                   [ '/tmp/bar/tuu/node_modules/@babel/plugin-transform-runtime/lib/index.js',
                     { absoluteRuntime: '/tmp/bar/tuu/node_modules/nwb',
                       useESModules: true } ],
                   '/tmp/bar/tuu/node_modules/@babel/plugin-syntax-dynamic-import/lib/index.js' ] } },
           { test: /\.(gif|png|webp)$/,
             loader: '/tmp/bar/tuu/node_modules/url-loader/dist/cjs.js',
             options: { limit: 1, name: '[name].[hash:8].[ext]' } },
           { test: /\.svg$/,
             loader: '/tmp/bar/tuu/node_modules/url-loader/dist/cjs.js',
             options: { limit: 1, name: '[name].[hash:8].[ext]' } },
           { test: /\.jpe?g$/,
             loader: '/tmp/bar/tuu/node_modules/url-loader/dist/cjs.js',
             options: { limit: 1, name: '[name].[hash:8].[ext]' } },
           { test: /\.(eot|otf|ttf|woff|woff2)$/,
             loader: '/tmp/bar/tuu/node_modules/url-loader/dist/cjs.js',
             options: { limit: 1, name: '[name].[hash:8].[ext]' } },
           { test: /\.(mp4|ogg|webm)$/,
             loader: '/tmp/bar/tuu/node_modules/url-loader/dist/cjs.js',
             options: { limit: 1, name: '[name].[hash:8].[ext]' } },
           { test: /\.(wav|mp3|m4a|aac|oga)$/,
             loader: '/tmp/bar/tuu/node_modules/url-loader/dist/cjs.js',
             options: { limit: 1, name: '[name].[hash:8].[ext]' } },
           { test: /\.css$/,
             use:
              [ { loader: '/tmp/bar/tuu/node_modules/style-loader/dist/cjs.js' },
                { loader: '/tmp/bar/tuu/node_modules/css-loader/dist/cjs.js',
                  options: { importLoaders: 1 } },
                { loader: '/tmp/bar/tuu/node_modules/postcss-loader/src/index.js',
                  options:
                   { ident: 'postcss',
                     plugins:
                      [ { [Function: plugin]
                          options:
                           { overrideBrowserslist:
                              'last 1 chrome version, last 1 firefox version, last 1 safari version' },
                          browsers:
                           'last 1 chrome version, last 1 firefox version, last 1 safari version',
                          info: [Function],
                          postcssPlugin: 'autoprefixer',
                          postcssVersion: '7.0.36' } ] } } ] } ],
        strictExportPresence: true },
     output: {},
     performance: { hints: false },
     optimization: {},
     plugins:
      [ CaseSensitivePathsPlugin {
          options: {},
          logger:
           Console {
             log: [Function: bound consoleCall],
             debug: [Function: bound consoleCall],
             info: [Function: bound consoleCall],
             dirxml: [Function: bound consoleCall],
             warn: [Function: bound consoleCall],
             error: [Function: bound consoleCall],
             dir: [Function: bound consoleCall],
             time: [Function: bound consoleCall],
             timeEnd: [Function: bound consoleCall],
             timeLog: [Function: bound timeLog],
             trace: [Function: bound consoleCall],
             assert: [Function: bound consoleCall],
             clear: [Function: bound consoleCall],
             count: [Function: bound consoleCall],
             countReset: [Function: bound consoleCall],
             group: [Function: bound consoleCall],
             groupCollapsed: [Function: bound consoleCall],
             groupEnd: [Function: bound consoleCall],
             table: [Function: bound consoleCall],
             Console: [Function: Console],
             markTimeline: [Function: markTimeline],
             profile: [Function: profile],
             profileEnd: [Function: profileEnd],
             timeline: [Function: timeline],
             timelineEnd: [Function: timelineEnd],
             timeStamp: [Function: timeStamp],
             context: [Function: context],
             [Symbol(counts)]: Map {},
             [Symbol(kColorMode)]: 'auto' },
          pathCache: {},
          fsOperations: 0,
          primed: false },
        DefinePlugin { definitions: { 'process.env.NODE_ENV': '"test"' } },
        LoaderOptionsPlugin {
          options:
           { options: { context: '/tmp/bar/tuu' },
             test: { test: [Function: test] } } },
        StatusPlugin {
          disableClearConsole: false,
          quiet: true,
          successMessage: '',
          isInitialBuild: true,
          watchRun: [Function],
          done: [Function] } ],
     resolve:
      { alias:
         { expect: '/tmp/bar/tuu/node_modules/expect',
           src: '/tmp/bar/tuu/src' } },
     resolveLoader:
      { modules:
         [ 'node_modules', '/tmp/bar/tuu/node_modules/nwb/node_modules' ] },
     devtool: 'cheap-module-inline-source-map',
     node: { fs: 'empty' } },
  webpackMiddleware: { logLevel: 'silent' } } +8ms

START:
08 09 2021 21:48:01.730:INFO [karma-server]: Karma v5.0.9 server started at http://0.0.0.0:9876/
08 09 2021 21:48:01.731:INFO [launcher]: Launching browsers PhantomJS with concurrency unlimited
08 09 2021 21:48:01.752:INFO [launcher]: Starting browser PhantomJS
08 09 2021 21:48:01.935:INFO [PhantomJS 2.1.1 (Linux x86_64)]: Connected on socket Lm8ksdwzngeWdRqIAAAA with id 53746178
PhantomJS 2.1.1 (Linux x86_64) ERROR
  TypeError: Object is not a function (evaluating '__webpack_require__(/*! object.getprototypeof/polyfill */ "./node_modules/object.getprototypeof/polyfill.mjs")()')
  at webpack:///node_modules/is-equal/why.js:21:1 <- tests/App.test.js:4893:132

Finished in 0.236 secs / 0 secs @ 21:48:02 GMT+0200 (heure d’été d’Europe centrale)

SUMMARY:
✔ 0 tests completed
Karma exit code was 1

jonenst avatar Sep 08 '21 20:09 jonenst