Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ orbs:
browser-tools: circleci/browser-tools@2.2.0

jobs:
lint:
docker:
- image: cimg/node:22.18 # eslint 9.x requires 18+, so we've separated it from the test step
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
steps:
- checkout
- run:
name: NPM install
command: npm ci
- run:
name: Lint
command: npm run lint
run-tests:
parameters:
node-version:
Expand Down Expand Up @@ -57,12 +71,19 @@ workflows:
version: 2
test-and-publish:
jobs:
- lint:
context:
- particle-ci-private
# run tests for all branches
filters:
branches:
only: /.*/
- run-tests:
context:
- particle-ci-private
matrix:
parameters:
node-version: ["12.22.12", "14.19.2", "16.20.0"]
node-version: ["16.20.0", "22.18"]
# run tests for all branches and tags
filters:
tags:
Expand All @@ -71,6 +92,7 @@ workflows:
only: /.*/
- publish-npm:
requires:
- lint
- run-tests
context:
- particle-ci-private
Expand Down
25 changes: 0 additions & 25 deletions .eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
22
30 changes: 15 additions & 15 deletions EventStream-e2e-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Steps:
- Follow the scenarios in EventStream.feature

*/

'use strict';
const Particle = require('./src/Particle');
const baseUrl = process.env.PARTICLE_API_BASE_URL || 'http://localhost:9090';
const auth = process.env.PARTICLE_API_TOKEN;
Expand All @@ -16,19 +16,19 @@ const particle = new Particle({ baseUrl });

/* eslint-disable no-console */
particle.getEventStream({ deviceId: 'mine', auth })
.then(stream => {
console.log('event stream connected');

['event', 'error', 'disconnect', 'reconnect', 'reconnect-success', 'reconnect-error']
.forEach(eventName => {
stream.on(eventName, (arg) => {
console.log(eventName, arg);
});
});
})
.catch((err) => {
console.error(err);
process.exit(1);
});
.then(stream => {
console.log('event stream connected');

['event', 'error', 'disconnect', 'reconnect', 'reconnect-success', 'reconnect-error']
.forEach(eventName => {
stream.on(eventName, (arg) => {
console.log(eventName, arg);
});
});
})
.catch((err) => {
console.error(err);
process.exit(1);
});
/* eslint-enable no-console */

2 changes: 1 addition & 1 deletion dist/particle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/particle.min.js.map

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { particle } from 'eslint-config-particle';

export default particle({
rootDir: import.meta.dirname,
testGlobals: 'mocha',
globalIgnores: ['dist']
});
1 change: 1 addition & 0 deletions fs.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
// In Node, exports the fs module. In the browser, exports undefined due to "./fs": false entry in package.json
'use strict';
module.exports = require('fs');
119 changes: 60 additions & 59 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,79 +1,80 @@
// Karma configuration
// Generated on Wed Jul 20 2016 12:00:09 GMT-0400 (EDT)
'use strict';
const webpackConf = require('./webpack.config.js');
const webpack = require('webpack');

module.exports = function karmaCfg(config){
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['webpack', 'mocha', 'chai'],
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['webpack', 'mocha', 'chai'],

// list of files / patterns to load in the browser
files: [
'dist/particle.min.js',
'test/*.spec.js',
'test/*.integration.js'
],
// list of files / patterns to load in the browser
files: [
'dist/particle.min.js',
'test/*.spec.js',
'test/*.integration.js'
],

// list of files to exclude
exclude: [
],
// list of files to exclude
exclude: [
],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['webpack'],
'test/**/*.js': ['webpack']
},
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['webpack'],
'test/**/*.js': ['webpack']
},

// Transform test files to a single browser consumable file
webpack: {
mode: 'development',
target: 'web',
devtool: 'inline-source-map',
output: webpackConf.output,
externals: webpackConf.externals,
resolve: webpackConf.resolve,
plugins: [
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
new webpack.EnvironmentPlugin({
SKIP_AGENT_TEST: process.env.SKIP_AGENT_TEST || false
})
]
},
// Transform test files to a single browser consumable file
webpack: {
mode: 'development',
target: 'web',
devtool: 'inline-source-map',
output: webpackConf.output,
externals: webpackConf.externals,
resolve: webpackConf.resolve,
plugins: [
new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] }),
new webpack.EnvironmentPlugin({
SKIP_AGENT_TEST: process.env.SKIP_AGENT_TEST || false
})
]
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],

// web server port
port: 9876,
// web server port
port: 9876,

// enable / disable colors in the output (reporters and logs)
colors: true,
// enable / disable colors in the output (reporters and logs)
colors: true,

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,

// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox'],
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Firefox'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
};
Loading