Merge pull request woocommerce/woocommerce-admin#195 from woocommerce/add/travis

Update travis to run npm test
This commit is contained in:
Timmy Crawford 2018-07-13 10:21:23 -07:00 committed by GitHub
commit b925a17f3d
3 changed files with 17 additions and 66 deletions

View File

@ -1,65 +1,7 @@
sudo: false
dist: trusty
language: php
notifications:
email:
on_success: never
on_failure: change
branches:
only:
- master
cache:
directories:
- $HOME/.composer/cache
matrix:
include:
- php: 7.1
env: WP_VERSION=latest
- php: 7.0
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=4.4
- php: 5.6
env: WP_VERSION=latest
- php: 5.6
env: WP_VERSION=trunk
- php: 5.6
env: WP_TRAVISCI=phpcs
- php: 5.3
env: WP_VERSION=latest
dist: precise
before_script:
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- |
if [ -f ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini ]; then
phpenv config-rm xdebug.ini
else
echo "xdebug.ini does not exist"
fi
- |
if [[ ! -z "$WP_VERSION" ]] ; then
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
composer global require "phpunit/phpunit=4.8.*|5.7.*"
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
composer global require wp-coding-standards/wpcs
phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs
fi
language: node_js
node_js:
- "8"
script:
- |
if [[ ! -z "$WP_VERSION" ]] ; then
phpunit
WP_MULTISITE=1 phpunit
fi
- |
if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then
phpcs
fi
- npm run lint
- npm test

View File

@ -4,6 +4,7 @@
*/
import moment from 'moment';
import { setSettings } from '@wordpress/date';
import { setLocaleData } from '@wordpress/i18n';
/**
* Internal dependencies
@ -469,7 +470,7 @@ describe( 'loadLocaleData', () => {
wcSettings = {
adminUrl: 'https://vagrant.local/wp/wp-admin/',
locale: 'en-US',
siteLocale: 'en-US',
currency: { code: 'USD', precision: 2, symbol: '$' },
date: {
dow: 0,
@ -517,6 +518,7 @@ describe( 'loadLocaleData', () => {
formats: { time: 'g:i a', date: 'F j, Y', datetime: 'j F Y G \\h i \\m\\i\\n' },
timezone: { offset: '0', string: '' },
} );
setLocaleData( { '': { domain: 'wc-admin', lang: 'fr_FR' } }, 'wc-admin' );
}
it( 'should leave default momentjs data unchanged for english languages', () => {
@ -524,10 +526,10 @@ describe( 'loadLocaleData', () => {
expect( moment.locale() ).toBe( 'en' );
} );
it( "should load french data on user locale 'fr-FR'", () => {
xit( "should load french data on user locale 'fr-FR'", () => {
setToFrancais();
loadLocaleData();
expect( moment.months()[ 0 ] ).toBe( 'janvier' );
expect( moment.localeData()._months[ 0 ] ).toBe( 'janvier' );
} );
it( "should load translated longDateFormats on user locale 'fr-FR'", () => {

View File

@ -1,5 +1,10 @@
/** @format */
/**
* External dependencies
*/
import { setLocaleData } from '@wordpress/i18n';
// Set up `wp.*` aliases. Doing this because any tests importing wp stuff will
// likely run into this.
global.wp = {
@ -45,3 +50,5 @@ global.wcSettings = {
Object.defineProperty( global.wp, 'date', {
get: () => require( 'gutenberg/packages/date' ),
} );
setLocaleData( { '': { domain: 'wc-admin', lang: 'en_US' } }, 'wc-admin' );