Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 6f0f53e

Browse files
author
Gabriel Schulhof
committed
All: Re-enable CI and test runner
The followings will be left in the root of the repo: .eslintrc.json: Configuration file for eslint, which is responsible for linting all JS scripts Gruntfile.js: Main configuration file for grunt infra: Folder containing all supporting scipts package.json: Test runner definition tasks: Folder containing grunt integration .travis.yml: Travis CI integration
1 parent 3526a34 commit 6f0f53e

File tree

59 files changed

+63
-270
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+63
-270
lines changed
File renamed without changes.
File renamed without changes.

ocf/test-suite/Gruntfile.js renamed to Gruntfile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ var path = require( "path" );
2020

2121
require( "load-grunt-config" )( grunt, {
2222
configPath: [
23-
path.join( __dirname, "build", "tasks", "options" ),
24-
path.join( __dirname, "build", "tasks" )
23+
path.join( __dirname, "infra", "build", "tasks", "options" ),
24+
path.join( __dirname, "infra", "build", "tasks" )
2525
],
2626
init: true
2727
} );

README.md

Lines changed: 4 additions & 0 deletions
File renamed without changes.

ocf/test-suite/build/tasks/options/eslint.js renamed to infra/build/tasks/options/eslint.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ module.exports = {
2222
src: [ "Gruntfile.js", "build/**/*.js" ]
2323
},
2424
lib: {
25-
src: [ "index.js", "lib/**/*.js" ]
25+
src: [ "infra/**/*.js" ]
2626
},
2727
tests: {
28-
src: [ "tests/**/*.js" ]
28+
src: Object.keys( require( "../../../../package.json" ).versions )
29+
.map( function( item ) {
30+
return require( "path" ).join( item, "tests", "**", "*" );
31+
} )
2932
}
3033
};

ocf/test-suite/index.js renamed to infra/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,21 @@ var defaultEndpointOptions = {
162162
spawn: spawn
163163
};
164164

165+
if ( !( options.api || options.apiVersion ) ) {
166+
throw new Error( "The options must contain both api and apiVersion" );
167+
}
168+
169+
var testsBasePath = path.join( __dirname, "..", options.api, "tests", options.apiVersion );
170+
165171
var actualOptions = {
166172
client: _.extend( {}, defaultEndpointOptions, options.client || {} ),
167173
server: _.extend( {}, defaultEndpointOptions, options.server || {} ),
168174
single: _.extend( {}, defaultEndpointOptions, options.single || {} ),
169175
tests: ( ( options.tests && Array.isArray( options.tests ) ) ?
170176
_.map( options.tests, function( item ) {
171-
return path.join( __dirname, "tests", item );
177+
return path.join( testsBasePath, item );
172178
} ) :
173-
( glob.sync( path.join( __dirname, "tests", "*" ) ) ) ).map( path.normalize )
179+
( glob.sync( path.join( testsBasePath, "*" ) ) ) ).map( path.normalize )
174180
};
175181

176182
if ( actualOptions.tests.length === 0 ) {
File renamed without changes.
File renamed without changes.

ocf/test-suite/LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

ocf/test-suite/package.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

package.json

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "iot-js-api",
33
"description": "OCF JS API specifications and test suites",
4-
5-
"version": "1.0",
4+
"main": "infra/index.js",
5+
"version": "1.0.0",
66
"versions": {
77
"ocf": "oic1.1.0-0",
88
"ble": "1.0",
99
"board": "1.0",
10-
"sensor": "1.0",
10+
"sensor": "1.0"
1111
},
1212

1313
"license": "Apache-2.0",
@@ -21,5 +21,21 @@
2121
"url": "https://github.com/01org/iot-js-api/issues"
2222
},
2323

24-
"homepage": "https://github.com/01org/iot-js-api#readme",
24+
"devDependencies": {
25+
"eslint-config-jquery": "0.1.2",
26+
"grunt": "^0.4.5",
27+
"grunt-eslint": "18.1.0",
28+
"load-grunt-config": "^0.17.2",
29+
"load-grunt-tasks": "^3.2.0"
30+
},
31+
"dependencies": {
32+
"async": "^2.0.0-rc.4",
33+
"glob": "^7.0.3",
34+
"lodash": "^4.12.0",
35+
"qunitjs": "^2.0.0-rc1",
36+
"tmp": "0.0.28",
37+
"uuid": "^2.0.2"
38+
},
39+
40+
"homepage": "https://github.com/01org/iot-js-api#readme"
2541
}

ocf/test-suite/tasks/iot-js-api-ocf.js renamed to tasks/iot-js-api.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414

1515
module.exports = function( grunt ) {
1616

17-
var _ = require( "lodash" ),
18-
testSuite = require( "../index" );
19-
path = require( "path" );
17+
var _ = require( "lodash" );
18+
var path = require( "path" );
19+
var testSuite = require( "../infra/index" );
2020

21-
grunt.task.registerMultiTask( "iot-js-api-ocf", "Run the OCF test suite", function() {
21+
grunt.task.registerMultiTask( "iot-js-api", "Run a test suite", function() {
2222
var done = this.async();
2323

2424
testSuite.defaultCallbacks.done = ( function( originalDone ) {

0 commit comments

Comments
 (0)