Skip to content
This repository was archived by the owner on Apr 3, 2024. It is now read-only.

Commit 1f07e00

Browse files
author
Matt Loring
committed
Start windows CI runs
1 parent 6c23941 commit 1f07e00

File tree

5 files changed

+69
-25
lines changed

5 files changed

+69
-25
lines changed

appveyor.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Test against this version of Node.js
2+
environment:
3+
matrix:
4+
# node.js
5+
- nodejs_version: "4"
6+
- nodejs_version: "6"
7+
8+
# Install scripts. (runs after repo cloning)
9+
install:
10+
# Get the latest stable version of Node.js or io.js
11+
- ps: Install-Product node $env:nodejs_version
12+
# install modules
13+
- npm install
14+
# set GCLOUD_PROJECT
15+
- SET GCLOUD_PROJECT=0
16+
17+
# Post-install test scripts.
18+
test_script:
19+
# run tests
20+
- ps: node_modules/.bin/mocha test --timeout 4000 --R
21+
- ps: ForEach ($test in Get-ChildItem test/standalone/test-*.js) { node_modules/.bin/mocha $test --timeout 4000 --R; if ($lastexitcode -ne 0) { exit 1 } }
22+
23+
# Don't actually build using MSBuild
24+
build: off

lib/v8debugapi.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ module.exports.create = function(logger_, config_, fileStats_) {
116116
var sm = require('source-map');
117117
var fs = require('fs');
118118
var sourcePos = {
119-
source: scriptPath.indexOf('/') === -1 ? scriptPath
120-
: scriptPath.split('/').pop(),
119+
source: scriptPath.indexOf(path.sep) === -1 ? scriptPath
120+
: scriptPath.split(path.sep).pop(),
121121
line: breakpoint.location.line,
122122
column: 0 // unlike lines, columns are 0-indexed for source-map ಠ_ಠ.
123123
};
@@ -349,7 +349,12 @@ module.exports.create = function(logger_, config_, fileStats_) {
349349
// make sure the script path starts with a slash. This makes sure our
350350
// regexp doesn't match monkey.js when the user asks to set a breakpoint
351351
// in key.js
352-
scriptPath = path.join('/', scriptPath);
352+
if (path.sep === '/' || scriptPath.indexOf(':') === -1) {
353+
scriptPath = path.join(path.sep, scriptPath);
354+
}
355+
if (path.sep !== '/') {
356+
scriptPath = scriptPath.replace(new RegExp('\\\\', 'g'), '\\\\');
357+
}
353358
return new RegExp(scriptPath + '$');
354359
}
355360

test/standalone/test-duplicate-expressions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var v8debugapi = require('../../lib/v8debugapi.js');
3131
var logModule = require('@google/cloud-diagnostics-common').logger;
3232
var config = require('../../config.js');
3333
var scanner = require('../../lib/scanner.js');
34+
var path = require('path');
3435

3536
function stateIsClean(api) {
3637
assert.equal(api.numBreakpoints_(), 0,
@@ -41,7 +42,7 @@ function stateIsClean(api) {
4142
}
4243

4344
describe('v8debugapi', function() {
44-
config.workingDirectory = process.cwd() + '/test/standalone';
45+
config.workingDirectory = path.join(process.cwd(), 'test', 'standalone');
4546
var logger = logModule.create(config.logLevel);
4647
var api = null;
4748

test/standalone/test-env-relative-repository-path.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@
1616

1717
'use strict';
1818

19+
var path = require('path');
20+
1921
process.env.GCLOUD_PROJECT = 0;
20-
process.env.GCLOUD_DEBUG_REPO_APP_PATH = '/my/project/root';
22+
process.env.GCLOUD_DEBUG_REPO_APP_PATH = path.join(path.sep, 'my', 'project', 'root');
2123

2224
var assert = require('assert');
2325
var agent = require('../..');
@@ -46,7 +48,8 @@ describe('repository relative paths', function() {
4648
id: 0,
4749
location: {
4850
line: 3,
49-
path: '/my/project/root/test/fixtures/a/hello.js'
51+
path: path.join(path.sep, 'my', 'project', 'root', 'test',
52+
'fixtures', 'a', 'hello.js')
5053
}
5154
};
5255
api.set(bp, function(err) {

test/test-v8debugapi.js

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var logModule = require('@google/cloud-diagnostics-common').logger;
3636
var config = require('../config.js');
3737
var StatusMessage = require('../lib/apiclasses.js').StatusMessage;
3838
var scanner = require('../lib/scanner.js');
39+
var path = require('path');
3940

4041
function stateIsClean(api) {
4142
assert.equal(api.numBreakpoints_(), 0,
@@ -107,7 +108,7 @@ function validateBreakpoint(breakpoint) {
107108
}
108109

109110
describe('v8debugapi', function() {
110-
config.workingDirectory = process.cwd() + '/test';
111+
config.workingDirectory = path.join(process.cwd(), 'test');
111112
var logger = logModule.create(config.logLevel);
112113
var api = null;
113114

@@ -159,7 +160,8 @@ describe('v8debugapi', function() {
159160
it('should set error for breakpoint in non-js files',
160161
function(done) {
161162
require('./fixtures/key-bad.json');
162-
var bp = { id: 0, location: {line: 1, path: 'fixtures/key-bad.json'}};
163+
var bp = { id: 0, location: {line: 1, path: path.join('fixtures',
164+
'key-bad.json')}};
163165
api.set(bp, function(err) {
164166
assert.ok(err, 'should return an error');
165167
assert.ok(bp.status);
@@ -173,7 +175,8 @@ describe('v8debugapi', function() {
173175
it('should disambiguate incorrect path if filename is unique',
174176
function(done) {
175177
require('./fixtures/foo.js');
176-
var bp = { id: 0, location: {line: 1, path: '/test/foo.js'}};
178+
var bp = { id: 0, location: {line: 1, path: path.join(path.sep, 'test',
179+
'foo.js')}};
177180
api.set(bp, function(err) {
178181
assert.ifError(err);
179182
api.clear(bp);
@@ -185,7 +188,8 @@ describe('v8debugapi', function() {
185188
function(done) {
186189
require('./fixtures/foo.js');
187190
// hello.js is not unique but a/hello.js is.
188-
var bp = { id: 0, location: {line: 1, path: '/Server/a/hello.js'}};
191+
var bp = { id: 0, location: {line: 1, path: path.join(path.sep, 'Server',
192+
'a', 'hello.js')}};
189193
api.set(bp, function(err) {
190194
assert.ifError(err);
191195
api.clear(bp);
@@ -235,7 +239,7 @@ describe('v8debugapi', function() {
235239
require('./fixtures/foo.js');
236240
var bp = {
237241
id: 'non-existent line',
238-
location: {path: './fixtures/foo.js', line: 500}
242+
location: {path: path.join('.', 'fixtures', 'foo.js'), line: 500}
239243
};
240244
api.set(bp, function(err) {
241245
assert.ok(err);
@@ -316,13 +320,19 @@ describe('v8debugapi', function() {
316320

317321
describe('path normalization', function() {
318322
var breakpoints = [
319-
{ id: 'path0', location: {line: 4, path: '/test/test-v8debugapi.js'}},
320-
{ id: 'path1', location: {line: 4, path: 'test/test-v8debugapi.js' }},
323+
{ id: 'path0', location: {line: 4, path: path.join(path.sep, 'test',
324+
'test-v8debugapi.js')}},
325+
{ id: 'path1', location: {line: 4, path: path.join('test',
326+
'test-v8debugapi.js')}},
321327
{ id: 'path2', location: {line: 4, path: __filename }},
322-
{ id: 'with . in path', location: {path: 'test/./test-v8debugapi.js', line: 4}},
323-
{ id: 'with . in path', location: {path: './test-v8debugapi.js', line: 4}},
324-
{ id: 'with .. in path', location: {path: 'test/../test-v8debugapi.js', line: 4}},
325-
{ id: 'with .. in path', location: {path: '../test/test-v8debugapi.js', line: 4}}
328+
{ id: 'with . in path', location: {path: path.join('test', '.',
329+
'test-v8debugapi.js'), line: 4}},
330+
{ id: 'with . in path', location: {path: path.join('.',
331+
'test-v8debugapi.js'), line: 4}},
332+
{ id: 'with .. in path', location: {path: path.join('test', '..',
333+
'test-v8debugapi.js'), line: 4}},
334+
{ id: 'with .. in path', location: {path: path.join('..', 'test',
335+
'test-v8debugapi.js'), line: 4}}
326336
];
327337

328338
breakpoints.forEach(function(bp) {
@@ -590,8 +600,8 @@ describe('v8debugapi', function() {
590600
function (done) {
591601
var bp = {
592602
id: 'coffee-id-1729',
593-
location: { path: './test/fixtures/coffee/transpile.coffee',
594-
line: 3 },
603+
location: { path: path.join('.', 'test', 'fixtures', 'coffee',
604+
'transpile.coffee'), line: 3 },
595605
condition: 'if n == 3 then true else false'
596606
};
597607
var tt = require('./fixtures/coffee/transpile');
@@ -616,8 +626,8 @@ describe('v8debugapi', function() {
616626
function (done) {
617627
var bp = {
618628
id: 'coffee-id-1729',
619-
location: { path: './test/fixtures/coffee/transpile.coffee',
620-
line: 3 },
629+
location: { path: path.join('.', 'test', 'fixtures', 'coffee',
630+
'transpile.coffee'), line: 3 },
621631
condition: 'process=false'
622632
};
623633
api.set(bp, function(err) {
@@ -631,7 +641,7 @@ describe('v8debugapi', function() {
631641
function (done) {
632642
var bp = {
633643
id: 'babel-id-1729',
634-
location: { path: './test/fixtures/es6/transpile.es6',
644+
location: { path: path.join('.', 'test', 'fixtures', 'es6', 'transpile.es6'),
635645
line: 3 },
636646
condition: 'i + j === 3'
637647
};
@@ -657,8 +667,8 @@ describe('v8debugapi', function() {
657667
function(done) {
658668
var bp = {
659669
id: 'coffee-id-1729',
660-
location: { path: './test/fixtures/coffee/transpile.coffee',
661-
line: 3 },
670+
location: { path: path.join('.', 'test', 'fixtures', 'coffee',
671+
'transpile.coffee'), line: 3 },
662672
expressions: ['if n == 3 then Math.PI * n else n']
663673
};
664674
var tt = require('./fixtures/coffee/transpile');
@@ -686,7 +696,8 @@ describe('v8debugapi', function() {
686696
function(done) {
687697
var bp = {
688698
id: 'coffee-id-1729',
689-
location: { path: './test/fixtures/coffee/transpile.coffee',
699+
location: { path: path.join('.', 'test', 'fixtures',
700+
'coffee', 'transpile.coffee'),
690701
line: 3 },
691702
expressions: [':)', 'n n, n', 'process=this', '((x) -> x x) n', 'return']
692703
};

0 commit comments

Comments
 (0)