Skip to content

Commit

Permalink
chore(test): Add test for Windows extended-length paths (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
sttk authored Jan 18, 2024
1 parent 3544dc6 commit 89a67e5
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions test/window-extended-length-paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

var expect = require('expect');
var os = require('os');
var path = require('path');

var childProcess = require('child_process');
var exec = childProcess.exec;

var eraseTime = require('./tool/erase-time');
var eraseLapse = require('./tool/erase-lapse');
var tildify = require('../lib/shared/tildify');

var gulpfileDir = path.resolve(__dirname, 'fixtures/gulpfiles');
var gulpfilePath = path.resolve(gulpfileDir, 'gulpfile.js');

var gulpJsPath = '\\\\?\\' + path.resolve(__dirname, '../bin/gulp.js');

describe('windows extended length paths', function() {
it('Should run normaly even if using \'\\\\?\\\'prefix in paths', function(done) {
if (os.platform() !== 'win32') {
this.skip();
return;
}

var cmd = ['node', gulpJsPath, '--no-color', '--gulpfile', gulpfilePath].join(' ');

exec(cmd, function cb(err, stdout, stderr) {
expect(err).toEqual(null);
expect(stderr).toEqual('');

var workingDir = tildify(gulpfileDir);
var usingGulpfile = tildify(gulpfilePath);

stdout = eraseLapse(eraseTime(stdout));
expect(stdout).toEqual('' +
'Working directory changed to ' + workingDir + '\n' +
'Using gulpfile ' + usingGulpfile + '\n' +
'Starting \'default\'...\n' +
'Starting \'test1\'...\n' +
'Starting \'noop\'...\n' +
'Finished \'noop\' after ?\n' +
'Finished \'test1\' after ?\n' +
'Starting \'test3\'...\n' +
'Starting \'described\'...\n' +
'Finished \'described\' after ?\n' +
'Finished \'test3\' after ?\n' +
'Starting \'noop\'...\n' +
'Finished \'noop\' after ?\n' +
'Finished \'default\' after ?\n' +
'');
done();
});
});
});

0 comments on commit 89a67e5

Please sign in to comment.