尝试运行“ npm测试”时,与棉绒有关的错误

时间:2018-12-27 15:34:32

标签: gulp eslint package.json npm-scripts stellar

我正在尝试运行命令“ npm test”,但它返回与皮棉有关的错误。看到下面的输出:

webdeb@asus:/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base$ npm test

> zagg-stellar-base@0.0.3 test /mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base
> babel-node ./node_modules/gulp/bin/gulp.js test:node

[16:25:11] Using gulpfile /mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/gulpfile.js
[16:25:11] Starting 'lint:src'...
[16:25:11] 'lint:src' errored after 27 ms
[16:25:11] AssertionError [ERR_ASSERTION]: missing path
    at Module.require (module.js:594:3)
    at require (internal/module.js:11:18)
    at requireFn (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/gulp-load-plugins/index.js:37:14)
    at Object.get (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/gulp-load-plugins/index.js:59:18)
    at Gulp.<anonymous> (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/gulpfile.js:13:19)
    at module.exports (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/orchestrator/index.js:134:8)
    at /mnt/c/Users/Debchakra/Desktop/Zagg-Stellar-Base/zagg-stellar-base/node_modules/gulp/bin/gulp.js:129:20
npm ERR! Test failed.  See above for more details.

以下是gulpfile的内容:

'use strict';

var gulp        = require('gulp');
var isparta     = require('isparta');
var plugins     = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var webpack     = require("webpack");

gulp.task('default', ['build']);

gulp.task('lint:src', function() {
  return gulp.src(['src/**/*.js'])
    .pipe(plugins.plumber())
    .pipe(plugins.jshint())
    .pipe(plugins.jshint.reporter('jshint-stylish'))
    .pipe(plugins.jshint.reporter('fail'));
});

// Lint our test code
gulp.task('lint:test', function() {
  return gulp.src(['test/unit/**/*.js'])
    .pipe(plugins.plumber())
    .pipe(plugins.jshint())
    .pipe(plugins.jshint.reporter('jshint-stylish'))
    .pipe(plugins.jshint.reporter('fail'));
});

gulp.task('build', function(done) {
  runSequence('clean', 'build:node', 'build:browser', done);
});

gulp.task('test', function(done) {
  runSequence('clean', 'test:node', 'test:browser', done);
});


gulp.task('hooks:precommit', ['build'], function() {
  return gulp.src(['dist/*', 'lib/*'])
    .pipe(plugins.git.add());
});

gulp.task('build:node', ['lint:src'], function() {
    return gulp.src('src/**/*.js')
        .pipe(plugins.babel())
        .pipe(gulp.dest('lib'));
});

gulp.task('build:browser', ['lint:src'], function() {
  return gulp.src('src/browser.js')
    .pipe(plugins.webpack({
      output: { library: 'ZaggStellarBase' },
      module: {
        loaders: [
          { test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader'}
        ]
      },
      plugins: [
        // Ignore native modules (ed25519)
        new webpack.IgnorePlugin(/ed25519/)
      ]
    }))
    .pipe(plugins.rename('zagg-stellar-base.js'))
    .pipe(gulp.dest('dist'))
    .pipe(plugins.uglify({
      output: {
        ascii_only: true
      }
    }))
    .pipe(plugins.rename('zagg-stellar-base.min.js'))
    .pipe(gulp.dest('dist'));
});

gulp.task('test:init-istanbul', ['clean-coverage'], function () {
  return gulp.src(['src/**/*.js'])
    .pipe(plugins.istanbul({
      instrumenter: isparta.Instrumenter
    }))
    .pipe(plugins.istanbul.hookRequire());
});

gulp.task('test:node', ['build:node', 'test:init-istanbul'], function() {
  return gulp.src(["test/test-helper.js", "test/unit/**/*.js"])
    .pipe(plugins.mocha({
      reporter: ['dot']
    }))
    .pipe(plugins.istanbul.writeReports());
});

gulp.task('test:browser', ["build:browser"], function (done) {
  var Server = require('karma').Server;
  var server = new Server({ configFile: __dirname + '/karma.conf.js' });
  server.start(function() {
    done();
  });
});

gulp.task('test:sauce', ["build:browser"], function (done) {
  var Server = require('karma').Server;
  var server = new Server({ configFile: __dirname + '/karma-sauce.conf.js' 
});
  server.start(function() {
    done();
  });
});

gulp.task('clean', function () {
  return gulp.src(['dist', 'lib'], { read: false })
      .pipe(plugins.rimraf());
});

gulp.task('watch', ['build'], function() {
  gulp.watch('lib/**/*', ['build']);
});

gulp.task('clean-coverage', function() {
  return gulp.src(['coverage'], { read: false })
    .pipe(plugins.rimraf());
});

gulp.task('submit-coverage', function() {
  return gulp
      .src("./coverage/**/lcov.info")
      .pipe(plugins.coveralls());
});

我希望这应该足够好,因为如果我运行npm test或gulp,该文件将被执行。您也可以参考此仓库:https://github.com/stellar/js-stellar-base

0 个答案:

没有答案